主题:  看看怎么修改这个分页代码?

idd

职务:普通成员
等级:1
金币:0.0
发贴:53
#12003/5/23 13:31:11
这个分页不是直接将数据库中东西分页现示,而是先筛选,再每页现示一定数量的东西
以下是代码:问题出在,虽然要显示的数量超过每一页能显示的数量的时候,会错现
“下一页”这个按钮,但是点击按钮并不能显示下一页内容

公布的答案



<%
const PgSz=10
const week = 7

set Conn1 = Server.CreateObject("ADODB.Connection")
    Conn1.Open "dsn=totejas;uid=sa;pwd=little;database=Kore"
    Set RS1 = Server.CreateObject("ADODB.RecordSet")
    Set RS2 = Server.CreateObject("ADODB.RecordSet")
sql1 = "SELECT date FROM date "
sql2="select nowtime from nowtime"

RS1.open sql1,Conn1,1,1
    RS2.open sql2,Conn1,1,1
    dat0=RS1("date")
    dat1=RS2("nowtime")
dat=cdate(dat0)
if Year(dat1)>Year(dat) then
n=53+DatePart("ww",dat1)-DatePart("ww",dat)
else
n=DatePart("ww",dat1)-DatePart("ww",dat)
end if
n=n+1
response.write "现在是第"
response.write n
response.write "周"
Response.Write "

"
response.Write titledata

set Conn = Server.CreateObject("ADODB.Connection")
    Conn.Open "dsn=totejas;uid=sa;pwd=little;database=Kore"
    Set RS = Server.CreateObject("ADODB.RecordSet")
sql = "SELECT * FROM answer_all where casttime<="&n&" order by ID "
RS.open sql,Conn,1,1
    
If RS.RecordCount=0 then
response.write "

对不起,现在没有相关信息

"
else
RS.PageSize = Cint(PgSz) '设定PageSize属性的值
Total=INT(RS.recordcount / PgSz * -1)*-1 '计算可显示页面的总数
PageNo=Request("pageno")
if PageNo="" Then
PageNo = 1
else
PageNo=PageNo+1
PageNo=PageNo-1
end if
ScrollAction = Request("ScrollAction")
if ScrollAction = " 上一页 " Then
PageNo=PageNo-1
end if
if ScrollAction = " 下一页 " Then
PageNo=PageNo+1
end if
if PageNo < 1 Then
PageNo = 1
end if
n=1
RS.AbsolutePage = PageNo
position=RS.PageSize*PageNo
pagebegin=position-RS.PageSize+1
if position < RS.RecordCount then
pagend=position
else
pagend= RS.RecordCount
end if

Response.Write "
"&"答案如下:"&"