asp偽繼承初探_執行個體代碼

來源:互聯網
上載者:User

其中使用到一個分頁類CPaging 複製代碼 代碼如下:Class CPaging
Public RS ' RecordSet對象
Public Mark ' 指標標籤
Private sSize ' 每頁顯示數
Private sTotal ' 總記錄數
Private sPage ' 當前頁碼
Private sCount ' 總頁碼
Private Sub Class_Initialize
sSize = 20
sPage = 1
sCount = 1
End Sub
Private Sub Class_Terminate
Closeobj RS
End Sub
'每頁顯示數
Property Let Size(Value)
sSize = Value
End Property
Property Get Size
Size = sSize
End Property
'當前頁碼
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
'總頁碼
Property Get Count
If sTotal Mod sSize = 0 Then
Count = sTotal \ sSize
Else
Count = sTotal \ sSize + 1
End If
End Property
'總記錄數
Property Get Total()
Total = sTotal
End Property
Public Function Open(Byval SQLString)
Try DB.Openquery(RS,SQLString)
sTotal = RS.RecordCount
End Function
End Class

以下是調用頁 複製代碼 代碼如下:Dim Products
Set Products = New CPaging
With Products
.Size = 15 '每頁顯示數
.Page = PageNum '當前頁
End With
Try Products.Open(ListSQL)
If Products.RS.Bof and Products.RS.Eof then
Response.Write("<TR><TD colspan=8>尋找無記錄</TD></TR>")
Else
Dim i
i = 0
Products.RS.Move (Products.Page - 1) * Products.Size
Do While 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

當看到第8行的時候,似乎窺到了.net的影子--命名空間?

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.