This page uses 0 cursor, that is, Rs.Open Sql,Conn,0,1. But it doesn't feel that it's much faster, and the paging time of 100,000 pieces of data is more than 300 seconds.
The code copy is as follows:
<%
'*********************************
'Name: Pagination Class
'Date: 2005/12/3
'Author: Leng Yue, Xilou
'Website: www.xilou.net | www.chinaCMS.org
'Description: None
'Copyright: Please refer to the source for reprinting, author
'*********************************
Class Page
Private CurrPage
Private PageN
Private UrlStr
Private TempStr
Private ErrInfo
Private IsErr
Private TotalRecord
Private TotalPage
Public PageRs
Private TempA(11)
Private TempB(8)
'------------------------------------------------------------
Private Sub Class_Initialize()
CurrPage=1'//The default display of the current page is the first page
PageN=10'//Default 10 pieces of data are displayed per page
UrlStr="#"
TempStr=""
ErrInfo="ErrInfo:"
IsErr=False
End Sub
Private Sub Class_Terminate()
If IsObject(PageRs) Then
PageRs.Close
Set PageRs=Nothing
End If
Erase TempA
Erase TempB
End Sub
'----------------------------------------------------------
'//Get the current page number
Public Property Let CurrentPage(Val)
CurrPage=Val
End Property
Public Property Get CurrentPage()
CurrentPage=CurrPage
End Property
'//Get the number of displayed pieces per page
Public Property Let PageNum(Val)
PageN=Val
End Property
Public Property Get PageNum()
PageNum=PageN
End Property
'//Get URL
Public Property Let Url(Val)
UrlStr=Val
End Property
Public Property Get Url()
Url=UrlStr
End Property
'//Get the template
Public Property Let Temp(Val)
TempStr=Val
End Property
Public Property Get Temp()
Temp=TempStr
End Property
'------------------------------------------------------------
Public Sub Exec(Sql,ConnObj)
On Error Resume Next
Set PageRs=Server.CreateObject("ADODB.RecordSet")
PageRs.CursorLocation = 3 'Using client cursors can improve efficiency
PageRs.PageSize = PageN 'Define the page record set number of records displayed per page
PageRs.Open Sql,ConnObj,0,1
If Err.Number<>0 Then
Err.Clear
PageRs.Close
Set PageRs=Nothing
ErrInfo=ErrInfo&"Error creating or opening record set..."
IsErr=True
Response.Write ErrInfo
Response.End
End If
TotalRecord=PageRs.RecordCount'//What if it is 0?
If TotalRecord>=1 Then
'----------------------------------------------------------------------------start
'//Calculate the total number of pages, Ps, why not use PageRs.PageCount?
'If TotalRecord Mod PageN=0 Then
'TotalPage=PageRs.RecordCount/PageN
'Else
'TotalPage=PageRs.RecordCount/PageN
'TotalPage=Abs(Int(TotalPage))
'End If
TotalPage=PageRs.PageCount
'// Process the current received page number, the default is 1, so if you are not a numeric type, you will be 1
If IsNumeric(CurrPage) Then