请大家看一下,我的分页错在哪里?

21cfan 2004-04-10 01:22:13
当前页能正常显示,但是下一页及尾页的链接显示没有此页,检查了半天,也没看出错在哪里?下面是代码,请指点.
<%
set rst=server.createobject("adodb.recordset")
sql="select * from ach order by id desc"
rst.open sql,conn,1,1
%>
<%
if Not(rst.bof and rst.eof) then'判别数据表中是否为空记录
NumRecord=rst.recordcount
rst.pagesize=10
NumPage=rst.Pagecount
if request("page")=empty then
NoncePage=1
else
if Cint(request("page"))<1 then
NoncePage=1
else
NoncePage=request("page")
end if
if Cint(Trim(request("page")))>Cint(NumPage) then NoncePage=NumPage
end if
else
NumRecord=0
NumPage=0
NoncePage=0
end if
%> <div align="right">
<input type="hidden" name="page" value="<%=NoncePage%>">
<%
if NoncePage>1 then
response.write "|<a href=info_manager.asp?page=1>首 页</a>| |<a href=info_manager?page="&NoncePage-1&">上一页</a>| "
else
response.write "|首 页| |上一页| "
end if
if Cint(Trim(NoncePage))<Cint(Trim(NumPage)) then
response.write "|<a href=info_manager?page="&NoncePage+1&">下一页</a>| |<a href=info_manager?page="&NumPage&">尾 页</a>|"
else
response.write "|下一页| |尾 页|"
end if
%>
 页次:<font color="#0033CC"><%=NoncePage%></font>/<font color="#0033CC"><%=NumPage%></font>
共<font color="#0033CC"><%=NumRecord%></font>条记录  </div>
...全文
34 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
21cfan 2004-04-10
  • 打赏
  • 举报
回复
楼上大姐:我想要有含有首页、尾页的
jiffer 2004-04-10
  • 打赏
  • 举报
回复
给你个分页函数。
<%
private function fenye(rs, pagesize,args)
Dim intcur
Dim intpagesize
Dim total
Dim inttotal

args = split(args,",")
if Request.querystring("page")="" then
intcur=1
page = "first"
else
select case request("page")
     case "first"
        intcur=1
        case "previous"
        intcur=cint(request("curpage"))
        intcur=intcur-1
        case "next"
        intcur=cint(request("curpage"))
        intcur=intcur+1
        case "last"
        intcur=cint(request("lastpage"))
        case else
          intcur=request("page")
end select
end if
%>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
     <td colspan="2" height="58">
  <%
  if rs.eof then
  response.write "没有栏目:("
  else
  intpagesize=pagesize
  rs.pagesize=intpagesize
  if not rs.eof then
   rs.AbsolutePage=intcur
  end if
  total=rs.recordcount
  inttotal=rs.pagecount
  Dim i
  i = 0
  %>
  <table border = 1 align = center>
  
   <tr>
   <%
   Dim n
   n = 0
   do while n <= UBound(args)%>
    <th>
    <%response.write args(n)%>
    </th>
    <%
   n = n + 1
   loop
    %>
   </tr>
   <%
   do while NOT rs.EOF and i<intpagesize%>
   <tr>
   <%
   Dim l
   l = 0
   do while l <= UBound(args)
   %>  
   <td>
    <%=rs(args(l))%>
   </td>
   <%
   l = l + 1
   loop
   %>
   </tr>
   <%
   i = i + 1
   rs.MoveNext
   loop
   %>
  </table>
  <%
  end if%>
 </td>
</tr>
</table>
<div align="center"><br>
<%=intcur%> /<%=inttotal%>
<% if intcur>1 then %>
 <a href="index.asp?page=previous&curpage=<%=intcur%>">上一页</a>
<%else%>
 上一页
<%end if
intcur=cint(intcur)
inttotal=cint(inttotal)%>
<%if intcur<inttotal then%>
 <a href="index.asp?page=next&curpage=<%=intcur%>">下一页</a>
<%else%>
 下一页
<%end if%>
</div>
<%
rs.close
set rs = nothing
end function
%>
jiffer 2004-04-10
  • 打赏
  • 举报
回复
没有循环for i=1 to rs.pagesize

28,391

社区成员

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

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