关于ASP分页

来源:百度知道 编辑:UC知道 时间:2024/06/29 23:45:19
我的留言板分页时,固定每页存放10条记录,但是我想把每页的记录数改一下,比如说每页换成5条记录,我就把const MaxPerPage=10 改成
const MaxPerPage=5,但是只能显示5条,再添加第六条时,愚笨第一条的记录就没了,而且第一页,上一页,下一页,最后一页的字也不会出现,我也试过改动rs.open sql,conn,1,1中的1,1可是情况还是一样
请问要怎么改动代码才能改变每页显示的记录数?比如说每页显示5条,
相关代码如下:
<%
const MaxPerPage=10 '分页显示的纪录个数
dim sql
dim rs
dim gstBookID
dim totalPut
dim CurrentPage
dim TotalPages
dim i,j
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
%>
<%
set rs=server.createobject("adodb.recordset")
sql="select * from book order by id desc"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
showpages
response.write "<p align='center'> 还 没 有 任 何 留 言</p>"
else
totalPut=rs.recordcount '记录总数
if currentPage=1 then

楼上的,他不是没有写完,是没有贴完。你直接换成我这个就完了,不存在任何问题 ^-^
不去调试了
下边这套分页代码一直在用,换上试试
<%
dim i,intPage,page,pre,last,filepath'定义变量
set rs = server.CreateObject("adodb.recordset")'创建对象
sql="select * from user order by user_ID desc"'定义SQL语句
rs.PageSize = 20 '这里设定每页显示的记录数
rs.CursorLocation = 3
rs.Open sql,conn,0,2,1 '这里执行你查询SQL并获得结果记录集
pre = true
last = true
page = trim(Request.QueryString("page"))'变量是跳转页面时的值

if len(page) = 0 then
intpage = 1
pre = false
else
if cint(page) =< 1 then
intpage = 1
pre = false
else
if cint(page) >= rs.PageCount then
intpage = rs.PageCount
last = false
else
intpage = cint(page)
end if
end if
end if
if not rs.eof then
rs.AbsolutePage = intpage
end if
%>
循环体开始:
<%
for i=1 to rs.PageSize
if rs.EOF or rs.BOF then exit for
%&g