which uses a paging class cpaging
Copy Code code as follows:
Class cpaging
Public RS ' Recordset object
Public Mark ' pointer label
Private ssize ' Show number per page
Private stotal ' total record number
Private spage ' current page number
Private scount ' total page number
Private Sub Class_Initialize
Ssize = 20
Spage = 1
Scount = 1
End Sub
Private Sub Class_Terminate
Closeobj RS
End Sub
' Show number per page
Property Let Size (Value)
Ssize = Value
End Property
Property Get Size
Size = Ssize
End Property
' Current page number
Property Let Page (Value)
If not IsNumeric (Value) Then
Spage = 1
Else
Spage = Value
End If
End Property
Property Get Page
If (sPage-1) * ssize > Stotal Then
If stotal Mod ssize = 0 Then
Page = total \ ssize
Else
Page = total \ ssize +1
End If
ElseIf Spage < 1 Then
Page = 1
Else
Page = Spage
End If
End Property
' Total page number
Property Get Count
If stotal Mod ssize = 0 Then
Count = stotal \ Ssize
Else
Count = stotal \ ssize + 1
End If
End Property
' Total number of records
Property Get Total ()
Total = Stotal
End Property
Public Function Open (Byval sqlstring)
Try DB. Openquery (rs,sqlstring)
Stotal = RS. RecordCount
End Function
End Class
Here is the call page
Copy Code code as follows:
Dim Products
Set products = New cpaging
With products
. Size = 15 ' Show number per page
. page = Pagenum ' current page
End With
Try Products.open (Listsql)
If Products.RS.Bof and Products.RS.Eof Then
Response.Write ("<tr><td colspan=8> find no Records </TD></TR>")
Else
Dim I
i = 0
Products.RS.Move (products.page-1) * products.size
Do as not Products.RS.Eof
Response.Write ("<tr onmouseup=mouseup" (this); Onmousedown=mousedown (this); Onmouseover=mouseover (this); Onclick=click (this); Onmouseout=mouseout (This);> "&vbcrlf)
Response.Write ("<td align=middle nowrap>" & Products.rs ("Productsclassname") & "</TD>" & VBCRLF)
Response.Write ("<td align=left nowrap>" & Products.rs ("Productsname") & "</TD>" &vbcrlf)
Response.Write ("</TR>" &vbcrlf)
I=i+1
If i >= products.size Then Exit do
Products.RS.MoveNext
Loop
End If
When you see line 8th, you seem to have a glimpse of the shadow of. Net--namespaces?