程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 網頁編程 >> ASP編程 >> 關於ASP編程 >> asp偽繼承初探_實例代碼

asp偽繼承初探_實例代碼

編輯:關於ASP編程
其中使用到一個分頁類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的影子--命名空間?
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved