ASP:do while 双循环如何进行分页?
<%setrs1=server.createobject("adodb.recordset")sql1="select*fromcitywherememberid='"&...
<%set rs1=server.createobject("adodb.recordset")
sql1="select * from city where memberid='"&session("Memberid")&"' order by city asc"
rs1.open sql1,conn,1,1
do while not rs1.eof
'response.write rs1("city")
set rs=server.createobject("adodb.recordset")
sql="select * from shops where city='"&rs1("city")&"' order by uptime desc"
rs.open sql,conn,1,1
do while not rs.eof
%>
<%
%>
<tr bgcolor="#F8F8FA" >
<td align="left"> <%=rs("city")%></td>
<td><%=rs("Member")%></td>
<td><%=rs("sname")%></td>
<td><%=left(rs("address"),25)%></td>
<td><%=rs("addtime")%></td>
<td><a href="ShopsAllList.asp?id=<%=rs("id")%>">点击查看</a></td>
</tr>
<%
rs.movenext
loop
%>
<%
rs1.movenext
loop
%>
</table></td>
</tr>
<tr>
<td height="25" align="center" bgcolor="#FFFFFF"><div style="text-align:left;background-color:#e6e6e6; height:20px;padding-top:2px;font-size:12px;">
</div> </td>
</tr>
</table>
<%rs1.close
set rs1=nothing
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
请问我怎么分页啊?
下面是分页一些分页代码
<%
if (rs.eof and rs.bof) then
else
rs.pagesize=10
m=rs.pagesize
if request("page")="" then
page=1
rs.absolutepage=1
else
page=cint(request("page"))
rs.absolutepage=cint(request("page"))
end if
do while not rs.eof and m>0
%>
<%
rs.movenext
m=m-1
loop
end if
%>
<%
Dim Bpage
Bpage = Bpage & "共 <font color='#ff0000'>" & Cstr(Rs.RecordCount) & "</font> 条信息 "
Bpage = Bpage & "第 " & Cstr(page) & "/" & Cstr(rs.pagecount) & " 页"
If page > 1 Then
Bpage = Bpage & "<a href='?page="+cstr(1)+"'> 首页 </a> "
Bpage = Bpage & "<a href='?page="+Cstr(page-1)+"'> 上一页 </a> "
Else
Bpage = Bpage & " 上一页 "
End if
If page < Rs.PageCount Then
Bpage = Bpage & "<a href='?page="+Cstr(page+1)+"'> 下一页</a> "
Bpage = Bpage & "<a href='?page="+Cstr(Rs.PageCount)+"'> 尾页</a> "
Else
Bpage = Bpage & "下一页 "
End if
Bpage = Bpage & "转到:<input type='text' name='page' size=4 maxlength=4 class=smallInput value="&page&"> "
Bpage = Bpage & "<input type='submit' value='Go' name='cndok'> "
response.Write(Bpage)
%>
请高手指教 展开
sql1="select * from city where memberid='"&session("Memberid")&"' order by city asc"
rs1.open sql1,conn,1,1
do while not rs1.eof
'response.write rs1("city")
set rs=server.createobject("adodb.recordset")
sql="select * from shops where city='"&rs1("city")&"' order by uptime desc"
rs.open sql,conn,1,1
do while not rs.eof
%>
<%
%>
<tr bgcolor="#F8F8FA" >
<td align="left"> <%=rs("city")%></td>
<td><%=rs("Member")%></td>
<td><%=rs("sname")%></td>
<td><%=left(rs("address"),25)%></td>
<td><%=rs("addtime")%></td>
<td><a href="ShopsAllList.asp?id=<%=rs("id")%>">点击查看</a></td>
</tr>
<%
rs.movenext
loop
%>
<%
rs1.movenext
loop
%>
</table></td>
</tr>
<tr>
<td height="25" align="center" bgcolor="#FFFFFF"><div style="text-align:left;background-color:#e6e6e6; height:20px;padding-top:2px;font-size:12px;">
</div> </td>
</tr>
</table>
<%rs1.close
set rs1=nothing
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
请问我怎么分页啊?
下面是分页一些分页代码
<%
if (rs.eof and rs.bof) then
else
rs.pagesize=10
m=rs.pagesize
if request("page")="" then
page=1
rs.absolutepage=1
else
page=cint(request("page"))
rs.absolutepage=cint(request("page"))
end if
do while not rs.eof and m>0
%>
<%
rs.movenext
m=m-1
loop
end if
%>
<%
Dim Bpage
Bpage = Bpage & "共 <font color='#ff0000'>" & Cstr(Rs.RecordCount) & "</font> 条信息 "
Bpage = Bpage & "第 " & Cstr(page) & "/" & Cstr(rs.pagecount) & " 页"
If page > 1 Then
Bpage = Bpage & "<a href='?page="+cstr(1)+"'> 首页 </a> "
Bpage = Bpage & "<a href='?page="+Cstr(page-1)+"'> 上一页 </a> "
Else
Bpage = Bpage & " 上一页 "
End if
If page < Rs.PageCount Then
Bpage = Bpage & "<a href='?page="+Cstr(page+1)+"'> 下一页</a> "
Bpage = Bpage & "<a href='?page="+Cstr(Rs.PageCount)+"'> 尾页</a> "
Else
Bpage = Bpage & "下一页 "
End if
Bpage = Bpage & "转到:<input type='text' name='page' size=4 maxlength=4 class=smallInput value="&page&"> "
Bpage = Bpage & "<input type='submit' value='Go' name='cndok'> "
response.Write(Bpage)
%>
请高手指教 展开
2010-07-10
展开全部
把SQL合成一句么
sql="select * from shops where city in(select cityid from city where memberid='"&session("Memberid")&"') order by city,uptime desc"
sql="select * from shops where city in(select cityid from city where memberid='"&session("Memberid")&"') order by city,uptime desc"
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询