查詢翻頁優(yōu)化第1/2頁
代碼如下:
'//---- cocoon_自定義類_翻頁優(yōu)化代碼 ----//'
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 類系列 數據庫翻頁優(yōu)化"
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( "