分页问题,其他页显示良好,无论最后一页还有几条都只能显示一条
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>分页</title>
</head>
<body>
<!-- #include file="connect.asp" -->
<%
'接受外部值
currentpage=request("currentpage")
dim exec
dim i
exec="select id from dcrczp order by id desc"
set rs=conn.execute(exec)
'设置每页的记录数
rs.pagesize=25
'总记录数
rs.movefirst
do while not rs.eof
tempcount=tempcount+1
rs.movenext
loop
rs.movefirst
'总页数
pagenum=tempcount\rs.pagesize+1
'处理当前页
currentpage=request.querystring("currentpage")
if currentpage="" then
currentpage=1
end if
'记录从某页开始到该页结束显示
if cint(currentpage)=cint(pagenum) then
houmanyfields=(tempcount mod rs.pagesize)-1
else
howmanyfields=24
end if
rs.move (currentpage-1)*25
for i=0 to howmanyfields
%>
<table>
<tr>
<td><% =rs("id")%></td>
</tr>
<%
rs.movenext
next
%>
<tr>
<td>共<%=tempcount%>条记录,<%=pagenum%>页,当前第<%=currentpage%>页</td>
<td>
<%
'设置首页,上一页,下一页,尾页的连接
if currentpage<>1 then
response.write ("[<a href='dcrc_zp1.asp?currentpage=1' >首页</a>]")
response.write ("[<a href='dcrc_zp1.asp?currentpage="¤tpage-1&"'>上一页</a>]")
else
response.write("[首页][上一页]")
end if
if (currentpage+1)<>(pagenum+1) then
response.write ("[<a href='dcrc_zp1.asp?currentpage="¤tpage+1&"' >下一页</a>]")
response.write ("[<a href='dcrc_zp1.asp?currentpage="&pagenum&"'>尾页</a>]")
else
response.write("[下一页][尾页]")
end if
%>
</td>
</tr>
</table>
</body>
</html>