读二张表其中一个不会循环
读二张表其中一个不会循环。字段:ok1可据ID循环,但表2 字段:ok2 只是循环了第一个ID的数据。请高手指点。谢谢!表1:users1 字段:ok1 表2:users2 字段:ok2
<%
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"
end if
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
set rs1=server.createobject("adodb.recordset")
sql1="select * from users2 order by id asc"
rs1.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
%>
<div align="center">
<table border="1" width="100%" id="table1" style="border-collapse: collapse">
<tr>
<td>id</td>
<td>产品1</td>
<td>产品2</td>
</tr>
<tr>
<%do while not rs.eof%>
<td><%=rs("id")%></td>
<td><%=rs("ok1")%></td>
<td><%=rs1("ok2")%></td>
</tr>
<% i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop
%>
</table>