| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1119 人关注过本帖
标题:regedit进来看看拉!
只看楼主 加入收藏
belin2000
Rank: 3Rank: 3
等 级:论坛游侠
威 望:5
帖 子:975
专家分:194
注 册:2004-6-2
结帖率:0
收藏
 问题点数:0 回复次数:5 
regedit进来看看拉!

我自己写的一个分页程序,出错了,请大家指导! <!--#include file="conn.asp"--> <head> <meta http-equiv="Content-Language" content="zh-cn"> </head> <% sql="select * from allbook 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=5 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 bookbegin=pgsz*(pageno-1)+1 'bookbegin为rs指向的第一条记录的开始 if pgsz*pageno>totel-bookbegin then bookend=totel-bookbegin else bookend=pgsz*pageno end if %> <% if pageno>1 then '我觉得这个判断有问题 rs.move [pgsz*(pageno-1)-1] end if for i=bookbegin to bookend %> <div align="center"> <table cellpadding="0" cellspacing="0" width="770" height="119"> <!-- MSTableType="layout" --> <tr> <td valign="middle"> 书名:<%=rs("bookname")%></td> <td width="97"> 作者:<%=rs("zuozhe")%></td> <td width="173"> 出版社:<%=rs("chubanshe")%></td> <td width="140"> 出版时间:<%=rs("outtime")%></td> <td width="123"> 类别:<%=rs("leibie")%></td> <td height="23" width="117"> 价钱:<%=rs("piece")%></td> </tr> <tr> <td valign="top" width="120">  </td> <td valign="top" colspan="5" height="96"> <table style="table-layout:fixed" border="0" width="100%" cellspacing="0" cellpadding="0" id="table1"> <tr> <td width="61" style="word-break:break-all" valign="top">简介:</td> <td><%=rs("jianjie")%></td> </tr> </table> </td> </tr> </table> </div> <%rs.movenext next%> <div align="center"> <table cellpadding="0" cellspacing="0" width="770" height="20"> <!-- MSTableType="layout" --> <tr> <td valign="top" height="20" width="770"><a href="fenye1.asp?pageno"> <span style="text-decoration: none">第一页</span></a>| <% if pagecount>1 then a=pageno-1 b=pageno+1 if a>0 then response.write "<a href=fenye1.asp?pageno=" response.write a response.write "><<<</a>| " end if for i=1 to pagecount response.write "<a href=fenye1.asp?pageno=" response.write i response.write ">" response.write i response.write"</a> " next if pageno<>pagecount then '为什么当pageno=pagecount时 >>>还会出现? response.write " |<a href=fenye1.asp?pageno=" response.write b response.write ">>>></a> |" end if response.write "<a href=fenye1.asp?pageno=" response.write pagecount response.write "><span style='text-decoration: none'>最后一页</span></a>" end if %> <% rs.close set rs=nothing %> <% closeconn %></td> </tr> </table> </div> 当pgsz=5时,3,4是空的,1,2页有内容,(共4页) 当pgsz=10时,1页有内容,2页是空的,(共2页) 不解?

搜索更多相关主题的帖子: regedit 
2004-06-19 14:15
hell
Rank: 1
等 级:新手上路
帖 子:81
专家分:0
注 册:2004-6-3
收藏
得分:0 

帮你顶! 丁页!!!

[此贴子已经被作者于2004-06-19 17:21:55编辑过]


2004-06-19 16:08
belin2000
Rank: 3Rank: 3
等 级:论坛游侠
威 望:5
帖 子:975
专家分:194
注 册:2004-6-2
收藏
得分:0 

我已调好了,大家看看拉!

<!--#include file="conn.asp"--> <head> <meta http-equiv="Content-Language" content="zh-cn"> </head>

<% sql="select * from allbook 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=5 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 'bookbegin=pgsz*(pageno-1)+1 'bookbegin为rs指向的第一条记录的开始 'if pgsz*pageno>totel-bookbegin then 'bookend=totel-bookbegin 'else 'bookend=pgsz*pageno 'end if %> <% if (pageno-1)*pgsz<totel then '我觉得这个判断有问题 'gaidong rs.move pgsz*(pageno-1) ''gaidong end if %> <% dim i i=0 do while not rs.eof and i<pgsz

%> <table cellpadding="0" cellspacing="0" width="770" height="119"> <!-- MSTableType="layout" --> <tr> <td valign="middle"> 书名:<%=rs("bookname")%></td> <td width="97"> 作者:<%=rs("zuozhe")%></td> <td width="173"> 出版社:<%=rs("chubanshe")%></td> <td width="140"> 出版时间:<%=rs("outtime")%></td> <td width="123"> 类别:<%=rs("leibie")%></td> <td height="23" width="117"> 价钱:<%=rs("piece")%></td> </tr> <tr> <td valign="top" width="120">  </td> <td valign="top" colspan="5" height="96"> <table style="table-layout:fixed" border="0" width="100%" cellspacing="0" cellpadding="0" id="table1"> <tr> <td width="61" style="word-break:break-all" valign="top">简介:</td> <td><%=rs("jianjie")%></td> </tr> </table> </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="fenye.asp?pageno=1"> <span style="text-decoration: none">第一页</span></a>| <% if pagecount>1 then a=pageno-1 b=pageno+1 if a>0 then response.write "<a href=fenye.asp?pageno=" response.write a response.write "><<<</a>| " end if for i=1 to pagecount response.write "<a href=fenye.asp?pageno=" response.write i response.write ">" response.write i response.write"</a> " next if pageno*pgsz<totel then '为什么当pageno=pagecount时 >>>还会出现? '''gaidong response.write " |<a href=fenye.asp?pageno=" response.write pagecount response.write ">>>></a> |" end if response.write "<a href=fenye.asp?pageno=" response.write pagecount response.write "><span style='text-decoration: none'>最后一页</span></a>" end if %> <% rs.close set rs=nothing %> <% closeconn %></td> </tr> </table> </div>


59ita点com(我就爱TA)
2004-06-19 16:36
griefforyou
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:3336
专家分:0
注 册:2004-4-15
收藏
得分:0 

天津网站建设 http://www./
2004-06-19 18:30
寒星
Rank: 1
等 级:新手上路
帖 子:455
专家分:0
注 册:2004-6-7
收藏
得分:0 
有点意思

http://www. 版主位置空缺
2004-06-20 16:02
regedit
Rank: 5Rank: 5
等 级:贵宾
威 望:19
帖 子:950
专家分:0
注 册:2004-6-8
收藏
得分:0 

为什么当pageno=pagecount时 >>>还会出现?

我做的时候也是碰到这个!我那时想要当到最后一页时只出现“上一页”~~但是怎么也出不来这个结果!

pageno*pgsz<totel 不错!!!!!


最新作品:百货品牌商品资讯第一门户([url]http://www./[/url]),欢迎交流
2004-06-21 09:10
快速回复:regedit进来看看拉!
数据加载中...
 
   



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

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