硬件情况: AMD Athlon XP 2600+, 256 DDR
软件情况: MS Windows 2000 Advanced Server + IIS 5.0 + Access 2000 + IE 6.0
测试了局: 初度运转在 250(首页) - 400(末页)毫秒, (纪录数缓存后)在页面间跳转不乱在 47 毫秒以下.第1页跳到最初一页不多于 350 毫秒
合用局限: 用于通俗分页. 不合用于有较庞杂的查询时: 如前提为"[Title] Like '%最爱%'", 查询的工夫大大增添, 就算 Title 字段作了索引也没用. :(
<%@LANGUAGE = "VBScript" CODEPAGE="936"%>
<%Option Explicit%>
<%
Dim intDateStart
intDateStart = Timer()
Rem ## 翻开数据库毗连
Rem #################################################################
function f__OpenConn()
Dim strDbPath
Dim connstr
strDbPath = "../db/test.mdb"
connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
connstr = connstr & Server.MapPath(strDbPath)
Set conn = Server.CreateObject("Adodb.Connection")
conn.open connstr
End function
Rem #################################################################
Rem ## 封闭数据库毗连
Rem #################################################################
function f__CloseConn()
If IsObject(conn) Then
conn.close
End If
Set conn = nothing
End function
Rem #################################################################
Rem 取得履行工夫
Rem #################################################################
function getTimeOver(iflag)
Dim tTimeOver
If iflag = 1 Then
tTimeOver = FormatNumber(Timer() - intDateStart, 6, true)
getTimeOver = " 履行工夫: " & tTimeOver & " 秒"
Else
tTimeOver = FormatNumber((Timer() - intDateStart) * 1000, 3, true)
getTimeOver = " 履行工夫: " & tTimeOver & " 毫秒"
End If
End function
Rem #################################################################
Class Cls_PageView
Private sbooInitState
Private sstrCookiesName
Private sstrPageUrl
Private sstrPageVar
Private sstrTableName
Private sstrFieldsList
Private sstrCondiction
Private sstrOrderList
Private sstrPrimaryKey
Private sintRefresh
sintRecordCount = 0
sintPageSize = 0
sintPageNow = 0
sintPageMax = 0
End Sub
Rem ## 保留纪录数的 Cookies 变量
Public Property Let strCookiesName(Value)
sstrCookiesName = Value
End Property
Rem ## 转向地址
Public Property Let strPageUrl(Value)
sstrPageUrl = Value
End Property
Rem ## 表名
Public Property Let strTableName(Value)
sstrTableName = Value
End Property
Rem ## 字段列表
Public Property Let strFieldsList(Value)
sstrFieldsList = Value
End Property
Rem ## 查询前提
Public Property Let strCondiction(Value)
If Value <> "" Then
sstrCondiction = " WHERE " & Value
Else
sstrCondiction = ""
End If
End Property
Rem ## 排序字段, 如: [ID] ASC, [CreateDateTime] DESC
Public Property Let strOrderList(Value)
If Value <> "" Then
sstrOrderList = " ORDER BY " & Value
Else
sstrOrderList = ""
End If
End Property
Rem ## 用于统计纪录数的字段
Public Property Let strPrimaryKey(Value)
sstrPrimaryKey = Value
End Property