分页问题
<%
m1=request.Form("acreage1")
m2=request.Form("acreage2")
bianhao=request.Form("bianhao")
jy_id=request.Form("jy_id")
qu_id=request.Form("qu_id")
hu_id=request.Form("hu_id")
updatetime=request.Form("updatetime")
luduan="%"&trim(request.Form("key"))&"%"
sheshi="%"&trim(request.Form("key1"))&"%"
%>
。。
<%
set Rs=Server.CreateObject("Adodb.Recordset")
sql="select id,m,num,qu_id,jy_id,hu_id,date,luduan,estab,floor,money from info where 1=1"
if m1<>""then
sql=sql&" and clng(m)>"&clng(m1)
end if
if m2<>"" then
sql=sql&" and clng(m)<"&clng(m2)
end if
if bianma<>"" then
sql=sql &"and num='"&bianma&"'"
end if
if qu_id<>"" then
sql=sql & "and qu_id='"&qu_id&"'"
end if
if jy_id<>"不限" then
sql = sql & "and jy_id='"&jy_id&"'"
end if
if hu_id<>"不限" then
sql = sql & "and hu_id='"&hu_id&"'"
end if
if clng(updatetime)<>0 then
sql=sql & "and date>date-"&clng(updatetime)
end if
if luduan<>"" then
sql=sql&"and luduan like '"&luduan&"'"
end if
if sheshi<>"" then
sql=sql & "and estab like '"&sheshi&"'"
end if
Rs.open sql,conn,1,1
If Not (rs.eof and rs.bof) Then
rs.pagesize=20 '定义每页显示的记录数
pages=clng(Request("pages")) '获得当前页数
If pages<1 Then pages=1
If pages>rs.recordcount Then pages=rs.recordcount
showpage rs,pages '执行分页子程序showpage
Sub showpage(rs,pages) '分页子程序showpage(rs,pages)
rs.absolutepage=pages '指定指针所在的当前位置
For i=1 to rs.pagesize '循环显示记录%>
<tr bgcolor="#F7F7F7" class="tab11">
<td height="22" align="center"><span style="font-size: 9pt"><font color="#000000"><%=rs("num")%></font></span></td>
<td height="22" align="center"><span style="font-size: 9pt"><font color="#000000"><%=rs("qu_id")%></font></span></td>
<td height="22" align="center"><span style="font-size: 9pt"><font color="#000000"><%=rs("luduan")%></font></span></td>
<td height="22" align="center"><span style="font-size: 9pt"><font color="#000000"><%=rs("hu_id")%></font></span></td>
<td height="22" align="center"><span style="font-size: 9pt"><font color="#000000"><%=rs("floor")%></font></span></td>
<td height="22" align="center"><span style="font-size: 9pt"><font color="#000000"><%=rs("m")%></font></span></td>
<td height="22" align="center"><span style="font-size: 9pt"><font color="#000000"><%=rs("money")%></font></span></td>
<td height="22" align="center"><span style="font-size: 9pt"><font color="#000000"><%=rs("jy_id")%></font></span></td>
<td height="22" align="center"><span style="font-size: 9pt"><a style="cursor:hand;" onclick='window.open("show_source.asp?id=<%=rs("id")%>&type=2","","alwaysRaised=yes,resizable=no,minimizebutton=no,scrollbars=yes,width=580,height=500")'>
<font color="#000000">详细信息</font></a></span></td>
</tr>
<%
n=n+1
rs.movenext '指针向下移动
If rs.eof Then exit for
Next
End Sub
%>
</table>
<form name="form" action="?" method="get">
<%
If rs.recordcount > rs.pagesize Then
if pages<>1 then
response.Write(" <a href="&path&"?pages=1&action="&action&">首页</a>")
response.Write(" <a href="&path&"?pages="&(pages-1)&">上一页</a>")
end if
response.Write(" 当前 <font color='#FF0000'>"&pages&"/"&rs.pagecount&"</font> 页")
if pages<>rs.pagecount then
response.Write(" <a href="&path&"?pages="&(pages+1)&">下一页</a>")
response.Write(" <a href="&path&"?pages="&rs.pagecount&">末页</a>")
end if
rs.close
Set rs=Nothing
End If
%>
</form>
</tr>
<%Else%>
<tr>
<td align="center"><span class="STYLE2">此栏目暂无商品信息,请稍后查看!</span></td>
</tr>
<%End If%>
分页后第一页可以显示数据,但是第二页以后什么都没有,大家看看哪里出错了