这个分页程序错在哪啊?请大家帮下。。

laers 2004-04-08 06:29:11
<%
' 数据已链接成功!
rs.pagesize=2
nowpage=request("page")
if isempty(nowpage) then
rs.absolutepage=1
else if nowpage>rs.pagecount then
rs.absolutepage=rs.pagecount
else
rs.absolutepage=nowpage
end if
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<body>
<table width="75%" border="1" align="center">
<tr>
<td><div align="center">id</div></td>
<td>AA</td>
<td>BB</td>
</tr>
<%sub fin%>
<tr>
<td><%=rs("id")%></td>
<td><%=rs("aa")%></td>
<td><%=rs("bb")%></td>
</tr>
<%end sub%>
<%
for i=1 to rs.pagesize
fin
if rs.eof then
exit for
end if
rs.movenext
next
%>
</table>
<br>
<table width="75%" border="1" align="center">
<tr>
<td width="27%"><a href="page.asp?page=1">第一页</a></td>
<td width="25%"><a href="page.asp?page=<%=nowpage+1%>">下一页</a></td>
<td width="18%"><a href="page.asp?page=<%=nowpage-1%>">上一页</a></td>
<td width="30%"><a href="page.asp?page=<%=rs.PageCount%>">最后一页</a><td>
</tr>
</table>
</body>
</html>
...全文
61 8 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
jonasxujun 2004-04-08
  • 打赏
  • 举报
回复
<%
' 数据已链接成功!
rs.pagesize=2
nowpage=request("page")
if isempty(nowpage) then
nowpage=1
else
if nowpage>rs.pagecount then
nowpage=rs.pagecount
end if
end if
rs.absolutepage=nowpage

这样写nowpage就会有值了。。。
%>
jonasxujun 2004-04-08
  • 打赏
  • 举报
回复
问题在于nowpage=request("page")。

其实这个nowpage从头至尾都没获得值,那么你在链接中使用nowpage+1或nowpage-1当然也没钱值传下去。
Ccode 2004-04-08
  • 打赏
  • 举报
回复
rs.pagecount这个没有设定吧?
laers 2004-04-08
  • 打赏
  • 举报
回复
upupup
luluso 2004-04-08
  • 打赏
  • 举报
回复
else if nowpage>rs.pagecount then
rs.absolutepage=rs.pagecount
else
///
rs.pagecount从哪来的?有没值?
laers 2004-04-08
  • 打赏
  • 举报
回复
没错!!!就是点击下一页或上一页、最后一页时,没有跳到相应的记录。。
cjf1009 2004-04-08
  • 打赏
  • 举报
回复
报什么错误吗?
angelheavens 2004-04-08
  • 打赏
  • 举报
回复
rs.open sql,conn,1,1

28,409

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧