请各位大哥帮我看下asp翻页哪儿出错

来源:百度知道 编辑:UC知道 时间:2024/04/29 14:10:47
<%
set rs=server.CreateObject("ADODB.recordset") rs.open "select * from [111]",conn,1,3
Dim Page '当前显示的是第几页
Dim RecordCount '总记录条数
page = request("page")
if int(page)=0 then page=1
end if
rs.pagesize=5
rs.absolutepage=page
do while not rs.eof
%><tr><td width="100%" height="35">
·<%=rs("name")%></td>
</tr>
<%rs.movenext
loop
Dim fileName,postion
fileName = Request.ServerVariables("script_name")
postion = InstrRev(fileName,"/")+1
'取得当前的文件名称,使翻页的链接指向当前文件;
fileName = Mid(fileName,postion)
%>
<div align="center"><%if rs.recordcount>2 then%>
<div align="center" style="margin-top:20px;"><%if int(pa

修改如下:
<%
set rs=server.CreateObject("ADODB.recordset") rs.open "select * from [111]",conn,1,3
dim count
count=0
Dim Page '当前显示的是第几页
Dim RecordCount '总记录条数
page = request("page")
if (IsEmpty(page) or cint(page)<1 or cint(page)>rs.pagecount then
page=1
end if
rs.pagesize=5
rs.absolutepage=page
do while not rs.eof and count<>pagesize
%><tr><td width="100%" height="35">
·<%=rs("name")%></td>
</tr>
<%
count=count+1
rs.movenext
loop
Dim fileName,postion
fileName = Request.ServerVariables("script_name")
postion = InstrRev(fileName,"/")+1
'取得当前的文件名称,使翻页的链接指向当前文件;
fileName = Mid(fileName,postion)
%>
<div align="center"><%if rs.recordcount>2 then%>
<div align=&qu