Research on ASP pseudo-Inheritance _ instance code _ Application Tips

Source: Internet
Author: User
Tags inheritance
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?
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.