常用ASP.net分页为 DataGrid 控件 和 ADO分页
本分页为缓存唯一标识字段 只选出分页后的记录
对大量数据库分页提高了效率
NetPage.vb
Imports System.Web
Imports System.Data
Imports System.Data.OleDb
Namespace RyNetPage
Public Class NetPage
Inherits System.Web.UI.Page
Private Conn As OleDbConnection
Private DS As DataSet
Private DT As DataTable
Private SQLstr, ScriptName As String
Private GetPage, PageCount, ListCount As Integer
Private OrderStr, TableStr, IndexStr, ColumnStr, JscriptStr As String
Private PageSizeNum As Integer
Private PageIndex As String
Public Sub New()
ScriptName = "RyNetPage"
PageSizeNum = 10
End Sub
Public WriteOnly Property ConnStr()
Set(ByVal Value)
Try
Conn = New OleDbConnection(Value)
Conn.Open()
Catch ex As Exception
Echo(".New" & ex.Message.ToString)
End Try
End Set
End Property
Public WriteOnly Property Jscript() As String
Set(ByVal Value As String)
JscriptStr = Value
End Set
End Property
Public WriteOnly Property PageSize() As String
Set(ByVal Value As String)
PageSizeNum = Convert.ToInt32(Value)
End Set
End Property
Public WriteOnly Property Order() As String
Set(ByVal Value As String)
If AppCache("Order") <> Value Then
OrderStr = "Order " & Value
AppCache("Order") = OrderStr
WriteIndex()
End If
End Set
End Property
Public WriteOnly Property Table() As String
Set(ByVal Value As String)
TableStr = "[" & Value & "]"
End Set
End Property
Public WriteOnly Property Index() As String
Set(ByVal Value As String)
IndexStr = Value
End Set
End Property
Public WriteOnly Property Column() As String
Set(ByVal Value As String)
ColumnStr = Value
End Set
End Property
Public ReadOnly Property RecordsCount() As Integer
Get
Try
WriteIndex()
DT = AppCache("Index")
Return DT.Rows.Count
Catch ex As Exception
Echo(".RecordsCount " & ex.Message.ToString)
End Try
End Get
End Property
Public Function ShowRecords() As DataTable
Try
SQLstr = "Select " & ColumnStr & " From " & TableStr & PageWhere()
WriteIndex()
Dim Adapt As OleDbDataAdapter
Adapt = New OleDbDataAdapter(SQLstr, Conn)
DS = New DataSet
DS.Clear()
Adapt.Fill(DS)
Return DS.Tables(0)
&n