dim strsql,rs
dim intrecordnum,intcurrentpage,introwcount
introwcount = 0
dim intpagecount:intpagecount = 15 '每页20条记录
getconn_open
'获得总记录
set rs = conn.execute(select count(*) as intcounts from datainfo where sort=1 and flag_lm=1)
if rs.eof and rs.bof then
intrecordnum = 0
else
intrecordnum = cint(rs(intcounts))
end if
dim inttotalpages
if (intrecordnum mod intpagecount)>0 then
inttotalpages = int(intrecordnum/intpagecount) + 1
else
inttotalpages = intrecordnum/intpagecount
end if
intcurrentpage = 1
if isempty(request(txtpage)) or isnull(request(txtpage)) or trim(request(txtpage))= or (not isnumeric(request(txtpage))) or len(request(txtpage))>8 then
intcurrentpage = 1
elseif clng(request(txtpage)) intcurrentpage = 1
elseif clng(request(txtpage)) > inttotalpages then
intcurrentpage = inttotalpages
else
intcurrentpage = clng(request(txtpage))
end if
set rs = nothing
set rs = server.createobject(adodb.recordset)
strsql = select id,name,recreation,characteristic,address from datainfo where sort=1 and flag_lm=1 order by id desc limit & (intcurrentpage - 1) * intpagecount & , & intpagecount
rs.open strsql,conn,1,1
if rs.eof and rs.bof then
else
do while not rs.eof and introwcount introwcount = introwcount+1
rs.movenext
loop
end if
showpagenum intrecordnum,inttotalpages,intcurrentpage,intpagecount,objpage.txtscriptname,?
rs.close
set rs = nothing
set objpage = nothing
改一改就可以用了,呵呵
