七骑士亚服绑定邮箱:ASP分页问题:下面代码的分页,为什么总是只能看第一页呢?
来源:百度文库 编辑:高考问答 时间:2024/07/05 17:14:17
Set rs=Server.CreateObject("Adodb.RecordSet")
sql="select name from table order by id desc"
rs.Open sql,conn,1,2
i=2
rs.pagesize=i
pageno=request.QueryString("pageno")
if pageno="" or pageno>rs.pagecount then
pageno=1
end if
rsmanage.absolutepage=pageno
do while rsmanage.EOF=false and i>0
response.write "rs("name")<br>"
rsmanage.movenext
i=i-1
loop
response.Write("<a href=aa.asp?pageno=1>首页</a> <a href=aa.asp?pageno="&pageno-1&">上页</a> <a href=aa.asp?pageno="&pageno+1&">下页</a> <a href=aa.asp?pageno="&rsmanage.pagecount&">末页</a>")
sql="select name from table order by id desc"
rs.Open sql,conn,1,2
i=2
rs.pagesize=i
pageno=request.QueryString("pageno")
if pageno="" or pageno>rs.pagecount then
pageno=1
end if
rsmanage.absolutepage=pageno
do while rsmanage.EOF=false and i>0
response.write "rs("name")<br>"
rsmanage.movenext
i=i-1
loop
response.Write("<a href=aa.asp?pageno=1>首页</a> <a href=aa.asp?pageno="&pageno-1&">上页</a> <a href=aa.asp?pageno="&pageno+1&">下页</a> <a href=aa.asp?pageno="&rsmanage.pagecount&">末页</a>")
前面是rs
从后面开始怎么就是rsmanage了呢,这样是要报错的哦.
改动如下:
Set rs=Server.CreateObject("Adodb.RecordSet")
sql="select name from table order by id desc"
rs.Open sql,conn,1,3
i=2
rs.pagesize=i
pageno=request.QueryString("pageno")
if pageno="" or pageno>rs.pagecount or pageno<1 then
pageno="1"
pageno = cint(pageno)
end if
rs.absolutepage=pageno
do while not rs.eof and i>0
i = i-1
response.write rs("name")&"<br>"
rs.movenext
loop