28,406
社区成员
发帖
与我相关
我的任务
分享<%
'DB CONNECTION
'SELECT from the database
sSQL = "SELECT a.did as did, a.dname as dname, b.fnane as fnane FROM a INNER JOIN b ON a.did = b.did ORDER BY a.did;"
set oRS = oConn.Execute(sSQL)
dim Check, Count
Check = ""
Count = 0
Response.Write("<table><tr>")
Do While NOT oRS.EOF
IF Check <> oRS("dname") THEN
IF Count <> 0 THEN
Response.Write("</td>")
END IF
Response.Write("<td><b>"& oRS("dname") &"</b><br>")
Response.Write(oRS("fnane") &"<br>")
Count = 0
ELSE
Response.Write(oRS("fnane") &"<br>")
END IF
Check = oRS("dname")
Count = Count +1
oRS.MoveNext
Loop
Response.Write("</td>")
Response.Write("</tr></table>")
%>
<!--#include file="conn.asp" -->
<%
set pa= conn.execute("SELECT did,dname FROM a ORDER BY did")
str = "<table><tr>"
Do While NOT pa.EOF
str=str&"<td valign='top'>"&pa("dname")&"<br>"
set pb= conn.execute("SELECT fname FROM b where did="&pa("did"))
do while not pb.eof
str=str&pb(0)&"<br>"
pb.movenext
loop
pb.close
str=str&"</td>"
pa.MoveNext
Loop
pa.close
Response.Write str
%>
<%
'DB CONNECTION
'SELECT from the database
sSQL = "SELECT did, dname FROM a ORDER BY did;"
set oRS = oConn.Execute(sSQL)
sSQL1 = "SELECT did, fnane FROM b ORDER BY did;"
set oRS1 = oConn.Execute(sSQL1)
dim Info
Info=" "
'-----------从表a中读取------------
Response.Write("<table><tr>")
Do While NOT oRS.EOF
Response.Write("<td>"& oRS("dname") &"</td>")
oRS.MoveNext
Loop
Response.Write("</tr>")
Response.Write("<tr>")
oRS.MoveFirst
Do While NOT oRS.EOF
'-----------从表b中读取------------
Do While NOT oRS1.EOF
IF oRS("did") = oRS1("did") THEN
Info = Info & oRS1("fnane") & "<BR>"
END IF
oRS1.MoveNext
Loop
Response.Write("<td>"& info &"</td>")
Info=" "
oRS.MoveNext
Loop
Response.Write("</tr></table>")
%>