【jsp分页代码】我写的分页代码

更新时间:2014-07-21    来源:Access    手机版     字体:

【www.bbyears.com--Access】

access 测试地址:http://demo-asp.com/demo/works_list.asp
基本不受记录大小限制,15毫秒左右(access) sql存储过程的 几毫秒或0毫秒
http://www.joekoe.com/forum_view.asp?forum_id=3&view_id=54183


<%
sub works_list(pagesize,nsort,table,field,sqlwhere)
dim recordcount,pagecount,pageno,i
recordcount=application("recordcount"&sqlwhere)
if recordcount="" then
sql="select count(id) from works "&sqlwhere
set rs=conn.execute(sql)
recordcount=rs(0)"取得记录总数
application("recordcount"&sqlwhere)=recordcount
end if
pagecount=((recordcount-1)pagesize)+1"总页数
pageno=trim(request("pageno"))"当前页
if isempty(pageno) or not isnumeric(pageno) then
pageno=1
else
pageno=pageno
end if
if pageno<1 then
pageno=1
end if
if pageno*10 >= pagecount*10 then
pageno=pagecount
end if

if recordcount>0 then
call get_pageid(1,100,pagesize,pageno,table,sqlwhere,pagecount)
end if
response.write "序号作品名称作者创作日期"
i=0

If dblink=1 then
Sql="select top "&pagesize&" "&field&" from "&table&" "&sqlwhere
set rs=conn.execute(sql)
else
cmd.commandtext="page_list"
cmd.parameters("@pagesize")=pagesize
cmd.parameters("@table")=table
cmd.parameters("@field")=field
cmd.parameters("@sqlwhere")=sqlwhere
set rs=cmd.execute
end if

本文来源:http://www.bbyears.com/shujuku/7962.html

猜你感兴趣