回复 楼主 罗林鹏
我现在就是用这方法读入多个表,供你参考:
<%
if request("dj")<>"" then
sql="select * from users1 where userid="&request("dj")&" order by id asc"
else
sql="select * from users1
order by id asc"'第1表
end if
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
set rs1=server.createobject("adodb.recordset")'第2表
sql1="select * from users2 order by id asc"
rs1.open sql1,conn,1,1
set rs2=server.createobject("adodb.recordset")'第3表sql1="select * from users3 where mtype='2010' and question order by id asc"
rs2.open sql1,conn,1,1
if rs.eof and rs.bof then
response.write "<p align='center'> 还 没 有 任 何 记 录</p>"
else
totalPut=rs.recordcount
totalPut=rs.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
if currentPage=1 then
showpage totalput,MaxPerPage,"index.asp"
showContent
showpage totalput,MaxPerPage,"index.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move
(currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showpage totalput,MaxPerPage,"index.asp"
showContent
showpage totalput,MaxPerPage,"index.asp"
else
currentPage=1
showpage totalput,MaxPerPage,"index.asp"
showContent
showpage totalput,MaxPerPage,"index.asp"
end if
end if
end if
sub showContent
dim i
i=0
%>
<%do while not rs.eof%>
<%=rs("userid")%>
<%=rs1("userid")%> <%=rs2("userid")%>
<% i=i+1
if i>=MaxPerPage then exit do
rs.movenext'第一表,注意rs和下面的rs1
rs1.movenext'第二表
rs2.movenext'第三表
loop
%>