有关翻页的代码

ahuu 2003-09-12 07:11:42
rs.open strSQL1,conn,1,2
rs.pagesize = 4 '//令每夜显示4条记录
if not rs.eof then '//如果找到满足条件的记录
total = cstr(rs.pagecount)
currentpage = clng(request("currentPage"))
'//若按下下拉列表框右边的“确定”按钮
if request.Form("cmdOk")="确定" then
currentpage = request.Form("txtP") '//将当前页指定为下拉列表框中的数值
end if
if currentpage="" then
currentpage = 1 '//显示第一页的内容
end if
'处理非法页码问题
if currentpage="" or currentpage<1 then currentpage=1 end if
if currentpage>rs.pagecount then currentpage=rs.pagecount end if
rs.AbsolutePage = currentpage
sum = 0 初始化sum(总行数)变量的值
<table width="762" border="0" bgcolor="#CCCCCC">
<form name="queryForm" method="post" action="orderCheck.asp">
<input type="hidden" name="temPage" value="<%= currentpage %>">
<tr>
<td>
<%if currentpage > 1 then%><a href="orderCheck.asp?currentpage=<%=currentpage-1%>">[上一页]</a><%else%>[上一页]<%end if%>
<%if currentpage < rs.pagecount then%><a href="orderCheck.asp?currentpage=<%=currentpage+1%>">[下一页]</a><%else%>[下一页]<%end if%>
</td>
</tr>
</form>
</table>

在显示时,我用的是:while ((not rs.eof) and (sum < rs.pagesize)).....wend
问题是:点击下一页时,总是显示第一页,没翻过去
怎么办呢?是不是rs.AbsolutePage没接收到参数currentpage的值呢?
...全文
99 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
monkeys 2003-12-09
  • 打赏
  • 举报
回复
rs.open sql,conn,1,2
rs.pagesize = 15 '//令每页夜显示15条记录
if not rs.eof then '//如果找到满足条件的记录
total = cstr(rs.pagecount)
if(request.Form("ok") = "确定") then
currentpage = clng(request("txtCurrentpage"))
elseif ( currentpage="" ) then
currentpage = clng(request("page"))
end if
'处理非法页码问题
if currentpage<1 then currentpage=1 end if
if currentpage>rs.pagecount then currentpage=rs.pagecount end if
%>
<div align="center">

<table width="762" border="0" bgcolor="#CCCCCC" >
<tr>
<td width="557" class="text1"><font color="#000000">[共找到<font color="#FF0000"><%= rs.recordCount %></font>条记录]</font><font color="#000000">
[分<font color="#FF0000"><%= total %></font>页] </font><font color="#000000">[当前显示第<font color="#FF0000"><%= currentpage %></font>页]   
<%if currentpage>1 then%><a href="usr_cmpp_dy.asp?page=<%=currentpage-1%>">上一页</a><%else%>上一页<%end if%> |
<%if currentpage<rs.pagecount then%><a href="usr_cmpp_dy.asp?page=<%=currentpage+1%>">下一页</a><%else%>下一页<%end if%> </font></td>
</table>
sunzhikai1978 2003-12-09
  • 打赏
  • 举报
回复
根据需要改改吧

rs.open sql,conn,1,2
rs.pagesize = 15 '//令每页夜显示15条记录
if not rs.eof then '//如果找到满足条件的记录
total = cstr(rs.pagecount)
if(request.Form("ok") = "确定") then
currentpage = clng(request("txtCurrentpage"))
elseif ( currentpage="" ) then
currentpage = clng(request("page"))
end if
'处理非法页码问题
if currentpage<1 then currentpage=1 end if
if currentpage>rs.pagecount then currentpage=rs.pagecount end if
%>
<div align="center">

<table width="762" border="0" bgcolor="#CCCCCC" >
<tr>
<td width="557" class="text1"><font color="#000000">[共找到<font color="#FF0000"><%= rs.recordCount %></font>条记录]</font><font color="#000000">
[分<font color="#FF0000"><%= total %></font>页] </font><font color="#000000">[当前显示第<font color="#FF0000"><%= currentpage %></font>页]   
<%if currentpage>1 then%><a href="usr_cmpp_dy.asp?page=<%=currentpage-1%>">上一页</a><%else%>上一页<%end if%> |
<%if currentpage<rs.pagecount then%><a href="usr_cmpp_dy.asp?page=<%=currentpage+1%>">下一页</a><%else%>下一页<%end if%> </font></td>
</table>
iceheart 2003-09-12
  • 打赏
  • 举报
回复
select * from table where ... limit 10, 20
aryou 2003-09-12
  • 打赏
  • 举报
回复
可能第一页收到的值是负数所以先判断一下

if rs.AbsolutePage<0 then
rs.AbsolutePage=1
else




end if

28,391

社区成员

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

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