日期:2014-05-17  浏览次数:20898 次

在线等:关于asp的分页问题
从网络上找的一个分页函数,我调用的时候只能第一页能显示,其它页都无法显示。哪位帮我看下我的调用中哪出了问题。
同时不知道这个querry要设置的值是什么。

<!--#include   file= "conn.asp "-->
<!--#include   file= "inc/page_list.asp "-->
<%
set   plist=new   page_list

set   rs=server.createobject( "adodb.recordset ")
sql= "select   *   from   news   "
rs.open   sql,conn,3,1
plist.CalcPage   totalrec,msg_per_page,currentpage,n,rowcount,rs

  while   not   Rs.eof   and   rowcount> 0
  response.write   rs(0)& ". "&rs(1)& " <br> "
  Rs.movenext
  rowcount=rowcount-1
  wend
response.write   " <br> "
ListType= "1 "
url= " "
querry= " "
separator= "| "
ListLink= " "
plist.PageList   ListType,url,querry,Separator,ListLink
%>

==============
page_list.asp
==============
<%
class   Page_List
private   Sub   Class_Initialize  
Version= "ASP分页类     Version   1.0 "
end   sub
Private   Sub   Class_Terminate  
Version= " "
end   sub
'分页函数分为两个函数
'CalcPage(totalrec,msg_per_page,currentpage,n,rowcount,PageRs)   分页计算函数
'PageList(ListType,url,querry,Separator,ListLink)   分页列表函数

'分页计算函数
'totalrec   记录集总数
'msg_per_page   每页显示的记录数,在调用CalcPage时需提前对该变量赋值
'currentpage   当前页变量,在调用CalcPage时需提前对该变量赋值
'n   总页数    
'rowcount   设置每一页的数据记录数
'PageRs   记录集对象
public   sub   CalcPage(totalrec,msg_per_page,currentpage,n,rowcount,PageRs)
  n=0   '设置无记录时页数为0  
  totalrec=0
  if   msg_per_page= " "   then   msg_per_page=1
  if   currentpage= " "   then   currentpage=0
  'PageRs.EOF   and   PageRs.bof     无记录
  'Not   PageRs.EOF   Or   Not   PageRs.BOF   有记录
  if   Not   PageRs.EOF   Or   Not   PageRs.BOF   then  
    totalrec=PageRs.recordcount
    PageRs.pagesize=msg_per_page
    if   totalrec   mod   msg_per_page   =   0   then   '计算总页数,recordcount:数据的总记录数
      n   =   totalrec\msg_per_page   'n:总页数
    else  
      n   =   totalrec\msg_per_page+1  
    end   if  
    if   not   isnumeric(currentpage)   or   currentpage= " "   then   currentpage=1
    if   currentpage   <>   " "   then
      currentpage   =   cint(currentpage)
    end   if
    if   currentpage   <   1   then  
      currentpage   =   1
    end   if  
    if   currentpage*msg_per_page   >   totalrec   and   not((currentpage-1)*msg_per_page   <   totalrec)   then  
      currentPage=1
    end   if
    PageRs.absolutepage   = &nbs