【文章內(nèi)容簡介】
sstrCondiction = WHERE amp。 Value Else sstrCondiction = End If End Property Rem 排序字段, 如: [ID] ASC, [CreateDateTime] DESC Public Property Let strOrderList(Value) If Value Then sstrOrderList = ORDER BY amp。 Value Else sstrOrderList = End If End Property Rem 用于統(tǒng)計記錄數(shù)的字段 Public Property Let strPrimaryKey(Value) sstrPrimaryKey = Value End Propert Rem 每頁顯示的記錄條數(shù) Public Property Let intPageSize(Value)17 sintPageSize = toNum(Value, 20) End Property Rem 數(shù)據(jù)庫連接對象 Public Property Let objConn(Value) Set sobjConn = Value End Property Rem 當(dāng)前頁 Public Property Let intPageNow(Value) sintPageNow = toNum(Value, 1) End Property Rem 頁面參數(shù) Public Property Let strPageVar(Value) sstrPageVar = Value End Property Rem 是否刷新. 1 為刷新, 其他值則不刷新 Public Property Let intRefresh(Value) sintRefresh = toNum(Value, 0) End Property Rem 獲得當(dāng)前頁 Public Property Get intPageNow() intPageNow = singPageNow End Property Rem 分頁信息 Public Property Get strPageInfo() strPageInfo = sstrPageInfo End Property Rem 取得記錄集, 二維數(shù)組或字串, 在進行循環(huán)輸出時必須用 IsArray() 判斷18 Public Property Get arrRecordInfo() If Not sbooInitState Then Exit Property End If Dim rs, sql sql = SELECT amp。 sstrFieldsList amp。 _ FROM amp。 sstrTableName amp。 _ sstrCondiction amp。 _ sstrOrderList Set rs = () sql, sobjConn, 1, 1 If Not( or ) Then = sintPageSize = sintPageNow If Not( or ) Then arrRecordInfo = (sintPageSize) Else arrRecordInfo = End If Else arrRecordInfo = End If Set rs = nothing End Property Rem 初始化記錄數(shù) Private Sub InitRecordCount() sintRecordCount = 019 If Not(sbooInitState) Then Exit Sub Dim sintTmp sintTmp = toNum((_xp_ amp。 sstrCookiesName), 1) If ((sintTmp 0) Or (sintRefresh = 1))Then Dim sql, rs sql = SELECT COUNT( amp。 sstrPrimaryKey amp。 ) amp。 _ FROM amp。 sstrTableName amp。 _ sstrCondiction Set rs = (sql) If or Then sintTmp = 0 Else sintTmp = rs(0) End If sintRecordCount = sintTmp (_xp_ amp。 sstrCookiesName) = sintTmp Else sintRecordCount = sintTmp End If End Sub Rem 初始化分頁信息 Private Sub InitPageInfo() sstrPageInfo = If Not(sbooInitState) Then Exit Sub Dim surl surl = sstrPageUrl If Instr(1, surl, ?, 1) 0 Then surl = surl amp。 amp。 amp。 sstrPageVar amp。 =20 Else surl = surl amp。 ? amp。 sstrPageVar amp。 = End If If sintPageNow = 0 Then sintPageNow = 1 If sintRecordCount mod sintPageSize = 0 Then sintPageMax = sintRecordCount \ sintPageSize Else sintPageMax = sintRecordCount \ sintPageSize + 1 End If If sintPageNow sintPageMax Then sintPageNow = sintPageMax If sintPageNow = 1 then sstrPageInfo = 首頁 上一頁 Else sstrPageInfo = sstrPageInfo amp。 a href= amp。 surl amp。 1首頁/a sstrPageInfo = sstrPageInfo amp。 a href= amp。 surl amp。 (sintPageNow 1) amp。 上一/a End If If sintPageMax sintPageNow 1 then sstrPageInfo = sstrPageInfo amp。 下一頁 末頁 Else sstrPageInfo = sstrPageInfo amp。 a href= amp。 surl amp。 (sintPageNow + 1) amp。 下一/a sstrPageInfo = sstrPageInfo amp。 a href= amp。 surl amp。 sintPageMax amp。 末頁/a End If sstrPageInfo = sstrPageInfo amp。 頁次:strongfont color=990000 21amp。sintPageNow amp。 /font / amp。 sintPageMax amp。 /strong sstrPageInfo = sstrPageInfo amp。 共 strong amp。 sintRecordCount amp。 /strong 條記錄strong amp。 sintPageSize amp。 /strong 條/頁 End Sub Rem 長整數(shù)轉(zhuǎn)換 Private function toNum(s, Default) s = s amp。 If s And IsNumeric(s) Then toNum = CLng(s) Else toNum = Default End If End function Rem 類初始化 Public Sub InitClass() sbooInitState = True If Not(IsObject(sobjConn)) Then sbooInitState = False Call InitRecordCount() Call InitPageInfo() End SubEnd ClassDim strLocalUrlstrLocalUrl = (SCRIPT_NAME)Dim intPageNowintPageNow = (page)Dim intPageSize, strPageInfo22intPageSize = 30Dim arrRecordInfo, iDim Connf__OpenConn Dim clsRecordInfo Set clsRecordInfo = New Cls_PageView = [myTable] = strLocalUrl = [ID], [Title], [LastTime] = [ID] 10000 = [ID] ASC = [ID] = 20 = intPageNow = RecordCount = page = 0 = Conn arrRecordInfo = strPageInfo = Set clsRecordInfo = nothingf__CloseConn%htmlheadmeta equiv=ContentType content=text/html。 charset=gb2312title分頁測試/title23style type=text/css!—.PageView {fontsize: 12px。}.PageView td {borderrightstyle: solid。borderbottomstyle: solid。borderrightcolor: E0E0E0。borderbottomcolor: E0E0E0。borderrightwidth: 1px。borderbottomwidth: 1px。}.PageView table {borderleftstyle: solid。bordertopstyle: solid。borderleftcolor: E0E0E0。bordertopcolor: E0E0E0。bordertopwidth: 1px。borderleftwidth: 1px。} {background: EFF7FF。fontsize: 14px。fontweight: bold。lineheight: 120%。textalign: center。}24/stylestyle type=text/css!—body {fontsize: 12px。}a:link {color: 993300。textdecoration: none。}a:visited {color: 003366。textdecoration: none。}a:hover {color: 0066CC。textdecoration: underline。}a:active {color: 000000。textdecoration: none。}table {fontsize: 12px。}/style25/headbodytable width=100% border=0 cellspacing=0 cellpadding=4 tr td %= strPageInfo%/td/tr/tablediv class=PageView table width=100% border=0 cellspacing=0 cellpadding=4 tr class=Header tdID/td td描述/td td日期/td /tr% If IsArray(arrRecordInfo) Then For i = 0 to UBound(arrRecordInfo, 2)% tr td %= arrRecordInfo(0, i)%/td td %= arrRecordInfo(1, i)%/td td %= arrRecordInfo(2, i)%/td /