asp分页的一个类
在50,000条记录下测试过,速度比ado的那个要快多了
<%
'************************************************************************************
'具体用法
Dim strDbPath
Dim connstr
Dim mp
Set mp = New MyPage
strDbPath = "fenye/db.mdb"
connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
connstr = connstr & Server.MapPath(strDbPath)
Set conn = Server.CreateObject("Adodb.Connection")
conn.open connstr
set rs = mp.Execute("select * from table1",conn,29)
while not rs.eof
response.write rs("aaaa")&"<br>"
rs.MoveNext
wend
mp.pageDispaly()
'************************************************************************************
Class MyPage
private MyPage_Conn,MyPage_StrSql,MyPage_TotalStrSql,MyPage_RS,MyPage_TotalRS
private MyPage_PageSize
private MyPage_PageAbsolute,MyPage_PageTotal,MyPage_RecordTotal
private MyPage_Url
public property let conn(strConn)
set MyPage_Conn = strConn
end property
public property let PageSize(intPageSize)
MyPage_PageSize = Cint(intPageSize)
end property
public function PageExecute(strSql)
MyPage_PageAbsolute = MyPage_PageAbsoluteRequest()
MyPage_TotalStrSql = FormatMyPage_TotalStrSql(strSql)
set MyPage_TotalRS = MyPage_Conn.execute(MyPage_TotalStrSql)
MyPage_RecordTotal = MyPage_TotalRS("total")
MyPage_PageTotal = Cint(MyPage_RecordTotal/MyPage_PageSize)
MyPage_StrSql = FormatMyPage_StrSql(strSql)
set MyPage_RS = MyPage_Conn.execute(MyPage_StrSql)
dim i
i = 0
while not MyPage_RS.eof and i<(MyPage_PageAbsolute-1)*MyPage_PageSize
i = i + 1
MyPage_RS.MoveNext
asp分页的一个类
内容版权声明:除非注明,否则皆为本站原创文章。