菜鸟的小问题,请大家帮忙看看!

antheayao 2003-08-18 04:06:56
遇到了一个问题,下面的程序是分页显示的一段代码,请大家看错在哪里!谢了!!
<!--#include file="cn.asp"-->
<%
dim ps,numpage,curpage,w
ps=10

if request.QueryString("page")="" then
curpage=1
else
curpage = cint(request.querystring("page"))
end if
rst.open "select * from a",conn,1,1
rst.pagesize=ps
numpage=rst.pagecount
if curpage > numpage then
curpage = numpage
rst.absolutepage = curpage
end if
dim a
a=0
do while not rst.eof and a < ps
response.write rst("name")&"<br>"
rst.movenext
a = a + 1
loop
if curpage > 1 then

response.write "<a href=fenye.asp?page="&(curpage-1)&">上一页</a><br>"
end if
if curpage < numpage then

response.write "<a href=fenye.asp?page="&(curpage+1)&">下一页</a>"
end if
rst.close
conn.close
set rst = nothing
set conn = nothing
%>
...全文
21 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
楚人无衣 2003-08-18
  • 打赏
  • 举报
回复
rst.open "select * from a",conn,1,1
改成
rst.open "select * from a",conn,3试试
aBoris 2003-08-18
  • 打赏
  • 举报
回复
rs.open "select * from a",conn,1,1,1


if not(rs.eof and rs.bof) then
pgsz=10
rs.pagesize=Cint(pgsz)
total=rs.pagecount
PageNo=request("pageno")
if pageno="" then pageno=1
scrollAction=request("scrollaction")
if scrollaction="first" then pageno=1
if scrollaction="pre" then pageno=pageno-1
if scrollaction="next" then pageno=pageno+1
if scrollaction="last" then pageno=total
if pageno<1 then pageno=1
if request("inputpage")<>"" then pageno=cint(request("inputpage"))
n=1
rs.absolutepage=pageno
position=rs.pagesize*pageno
pagebegin=position-rs.pagesize+1
if position<rs.recordcount then
pageend=position
else
pageend=rs.recordcount
end if
end if%>
.
.
.
.
下面你自己写,要养成自己修改的习惯。
hfkj 2003-08-18
  • 打赏
  • 举报
回复
你首先应该设定每页的数目
再计算出一共有几页
也就是说最初的设置一定要做好

28,390

社区成员

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

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