做人没有梦想:asp 分页显示问题

来源:百度文库 编辑:高考问答 时间:2024/05/03 05:02:30
一共27条记录 每页应该显示10条 最后我调试出来的程序 也是分三页显示 每页分别显示27条 17条 7条
请大家帮我看看哪里出了问题,谢谢
<!--#include file="conn.asp"-->
<%
sql="select * from Jiudian_info order by id desc"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
const maxperpage=10
dim currentpage
rs.pagesize=maxperpage
currentpage=request.querystring("pageid") '获取页数
if currentpage="" then
currentpage=1
elseif currentpage<1 then
currentpage=1
else
currentpage=clng(currentpage)
if currentpage > rs.pagecount then
currentpage=rs.pagecount
end if
end if
if not isnumeric(currentpage) then
currentpage=1
end if
dim totalput,n
totalput=rs.recordcount
if totalput mod maxperpage=0 then
n=totalput\maxperpage
else
n=totalput\maxperpage+1
end if
if n=0 then
n=1
end if
rs.move(currentpage-1)*maxperpage
dim i
i=0
do while i< maxperpage and not rs.eof
%>
<tr>
<td bgcolor="#FFFFFF"><%=rs("id")%></td>
<td height="19" bgcolor="#FFFFFF"><%=rs("jiudian")%></td>
</tr>
<% rs.movenext
loop
%>
</table>
</td>
</tr>
</table>

do while i< maxperpage and not rs.eof
%>
<tr>
<td bgcolor="#FFFFFF"><%=rs("id")%></td>
<td height="19" bgcolor="#FFFFFF"><%=rs("jiudian")%></td>
</tr>
<%
i=i+1 '添加的
rs.movenext
loop
%>
</table>
</td>
</tr>
</table>

<%
for i=1 to rs.pagecount '一共分几页
%>
<a href="tan1.asp?pageid=<%=i%>"><%=i%></a>
<%
next
%>

变量i没有变化,应该在do while里面添加i=i+1

[[[[