查询翻页优化第1/2页
代码如下:
'//---- cocoon_自定义类_翻页优化代码 ----//'
class cc_db_pager
'--------------------------------
' cocoon db_pager 类 (ver: 1.02)
' 作者: sunrise_chen (sunrise_chen@msn.com)
' 请保留此信息,谢谢。
'
' 2003/06 修正一个错误,描述:如果id不唯一,将产生多条重复记录的错误。
' 2003.5
'--------------------------------
'//-------------------- 定义变量 --------------------//'
private stablename '//表名
private ssqlstring '//自定义sql语句
private acondition() '//查询条件(数组)
private scondition '//查询条件(字符串)
private ipage '//当前页码
private ipagesize '//每页记录数
private ipagecount '//总页数
private ireccount '//当前查询条件下的记录数
private itotalreccount '//总记录数
private sfields '//输出的字段名
private sorderby '//排序字符串
private ssql '//当前的查询语句
private spkey '//主键
private oconn '//连接对象
private idefpagesize '//默认每页显示的记录数
private sprojectname '/项目名
private sversion '/版本号
private bshowerror '//是否显示错误信息
'//-------------------- 事件、方法 --------------------//'
'//类初始化事件
private sub class_initialize()
redim acondition(-1)
ipage = 1
ireccount = null
itotalreccount = null
ipagecount = null
bshowerror = true
ipagesize = 10
sfields = "*"
spkey = "id"
scondition = ""
sorderby = ""
ssqlstring = ""
sprojectname = "cocoon 类系列 数据库翻页优化"
sversion = "1.02"
end sub
'//类结束事件
private sub class_terminate()
set oconn = nothing
end sub
'//错误处理
public sub doerror(s)
dim stmp
stmp = clng(rnd() * 100)
response.write( "
" )
response.write( "" )
response.write( "〖 cc_db_pager 提示信息 〗
" )
response.write( "
response.write( "" )
response.write( "〖 cc_db_pager 提示信息 〗
" )
response.write( "
response.write( "border: 1px solid #cccc00;padding:5;overflow:hidden;text-overflow:ellipsis;'>" )
response.write( "description: " & s & "
" )
response.write( "provider: " & sprojectname )
response.write( " version: " & sversion & "
" )
response.write( "
response.write( "description: " & s & "
" )
response.write( "provider: " & sprojectname )
response.write( " version: " & sversion & "
" )
response.write( "