| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 599 人关注过本帖
标题:[求助]分页问题。。。。。谢谢
只看楼主 加入收藏
滚水六脚
Rank: 1
等 级:新手上路
帖 子:132
专家分:0
注 册:2004-8-16
收藏
 问题点数:0 回复次数:4 
[求助]分页问题。。。。。谢谢

以下代码中,“下一页”到最后一页还是显示,并继续+1

对应的页没去掉超连接。。。。

问题在哪里?谢谢~~~

<!--#include file="conn.asp"--><head> <meta http-equiv="Content-Language" content="zh-cn"> <style type="text/css"> <!-- td { font-size: 12px; } --> </style> </head>

<% sql="select * from read1 order by id desc" set rs=server.createobject("adodb.recordset") rs.open sql,conn,1,1 if rs.recordcount=0 then 'rs.recordcount 所有记录数' response.write("数据库没有相关信息") else pgsz=2 pgct=4 rs.pagesize=cint(pgsz) totel=rs.recordcount pagecount=int(totel/pgsz*-1)*-1 pageno=request("pageno") 'pageno为当前页 if pageno="" then pageno=1 end if end if %> <% if (pageno-1)*pgsz<totel then rs.move pgsz*(pageno-1) '指针移到pgsz*(pageno-1)记录上 end if %> <% dim i i=0 do while not rs.eof and i<pgsz i=i+1 %>

<table cellpadding="0" cellspacing="0" width="770" height="31"> <!-- MSTableType="layout" --> <tr> <td width="279" valign="middle" bgcolor="#00FFFF"> 书名:<%=rs("name")%></td> <td width="54"> 出版社:</td> <td width="159"> 出版时间:</td> <td width="140"> 类别:</td> <td height="29" width="136"> 价钱:</td> </tr> </table>

<%rs.movenext loop %> </div>

<div align="center"> <table cellpadding="0" cellspacing="0" width="770" height="20"> <!-- MSTableType="layout" --> <tr> <td valign="top" height="20" width="770"><a href="index2_fenye.asp?pageno=1"> <span style="text-decoration: none">第一页</span></a>| <% if pagecount>1 then '前六页 a=int(pageno/pgct*-1)*-1 if a>1 then response.write "<a href=index2_fenye.asp?pageno=" response.write (a-1)*pgct response.write "><<<</a>| " end if num=0 i=(a-1)*pgct+1 while i<=pagecount and num<pgct if i=pageno then response.write i & " " else response.write "<a href=index2_fenye.asp?pageno=" response.write i response.write ">" response.write i response.write"</a> " end if i=i+1 num=num+1 wend

'下六页 if a*pgct<pagecount then response.write " |<a href=index2_fenye.asp?pageno=" response.write a*pgct+1 response.write ">>>></a> |" end if if pageno<pagecount then response.write "<a href=index2_fenye.asp?pageno="&pageno+1&"><span style='text-decoration: none'>下一页</span></a>&nbsp;" response.write "<a href=index2_fenye.asp?pageno=" response.write pagecount response.write "><span style='text-decoration: none'>最后一页</span></a>" end if end if %>

<% rs.close set rs=nothing %> <% conn.close %></td> </tr> </table> </div>

搜索更多相关主题的帖子: sql 数据 content include file 
2004-09-28 15:17
寒星
Rank: 1
等 级:新手上路
帖 子:455
专家分:0
注 册:2004-6-7
收藏
得分:0 
当下一页时,现比较这个页加1后是不是大于总页数,如果大于总页数,就不要加1了,如果不大于,就显示页数

http://www. 版主位置空缺
2004-09-28 15:32
滚水六脚
Rank: 1
等 级:新手上路
帖 子:132
专家分:0
注 册:2004-8-16
收藏
得分:0 

谢谢

还有一个呢?

if i=pageno then response.write i & " "

2004-09-28 16:06
寒星
Rank: 1
等 级:新手上路
帖 子:455
专家分:0
注 册:2004-6-7
收藏
得分:0 

if i=pageno then response.write i & " " 你的pagecount是总页数把?

if i=pagecount then response.write i & " "


http://www. 版主位置空缺
2004-09-29 10:05
woshiyfk
Rank: 1
等 级:新手上路
帖 子:74
专家分:0
注 册:2005-3-2
收藏
得分:0 
红色的那行字,缺少对象吧,我以前写成的是recordeset.count,可以使用

2007-04-10 10:09
快速回复:[求助]分页问题。。。。。谢谢
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.013946 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved