您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

asp+mysql分页_MySQL

2024/3/5 17:06:19发布23次查看
'asp+mysql分页,由axislover原创于2007年12月11日,是个雪花飘飘的日子
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
改一改就可以用了,呵呵
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product