博客 下载 推荐 服务 关于

  下载 | 程序 | UlewooPage分页组件

UlewooPage分页组件
  • UlewooPage分页组件
  • 2008-6-6 2:29:56
  • ASP.NET+ACCESS
  • 下载

UlewooPage分页组件适用于ASP.NET+ACCESS的Web应用,比ASP.NET自带的分页功能更为高效,尤其在处理大容量数据时更为明显。组件仅根据页码筛选出当前页面的记录显示,而不是对整个数据集进行分页,且根据当前记录在整个数据集中的位置选择更有效的筛选方式。例如对包含10万条记录的数据集进行分页,每页大小为50。每次调用时,仅筛选出当前页码的50条记录,并返回包含这50条记录的OleDbDataReader用来与页面上的ASP.NET数据显示控件(如DataGrid)进行绑定,因此不需要对DataGrid进行任何设定,直接绑定即可。且组件根据该50条记录在整个10万记录集中的位置是靠前还是靠后来决定筛选时从前还是从后开始,以进一步提高性能。如当该50条记录是第99,550至100,000个时,从数据集的后面开始筛选显然更有效。

下载地址:http://www.ulewoo.com/DownloadDetail.aspx?Id=11

UlewooPage分页组件,VB.Net+Access

Public Sub New(ByVal intPage As Integer, ByVal intPageSize As Integer, ByVal conn As OleDbConnection, ByVal strTable As String, ByVal strColOrder As String, ByVal strCol As String)

Public Function getReader() As OleDbDataReader

Public Function getNavInfo(ByVal bNoneUrlPara As Boolean, ByVal strParaName As String, ByVal strCssName As String) As String

参数及返回值:

构造函数New
参数:
intPage 当前页码
intPageSize 每页记录数(页面大小)
conn 数据库连接,OleDbConnection类型
strTable 数据表名称或者取得记录集的Select语句,如“Product”或“Select * From Product Where Price>100”。为数据表名称时表示对所有表中的数据记录分页,为记录集时将只对Select语句查询出的数据记录分页。
strColOrder 排序字段,只能有一个
strCol 需要取得的字段,一个或多个,多个字段以逗号隔开。若要取得所有字段,可以以“*”表示
返回值:无

函数getReader
参数:无
返回值:仅含当前页码的记录集的OleDbDataReader,用于数据绑定

函数getNavInfo
参数:
bNoneUrlPara Url除了页码参数之外没有传递其它参数,则为True,否则为False
strParaName Url中表示页码的参数名称,若以“http://www.ulewoo.com?P=2” 为例,这个参数名称就为“P”,当然也可以为“Page”、“PageNo”等任意字符串。
strCssName 输出页码超链接的Css样式名称,可以为空字符串
返回值:页码链接字符串

应用步骤:

1、将UlewooPageOledb.dll放入网站根目录下的bin文件夹;
2、代码头部加上“Imports UlewooPage”;
3、读取Url中的页码,创建一个OleDbConnection连接,在页面放置一个数据显示控件(如DataGrid)和一个用来显示页码链接的Label;
4、创建UlewooPage对象,并调用getNavInfo将返回的字符串在Label上显示。

示例代码(VB):

窗体:
<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>UlewooPage Sample</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DataGrid ID="DataGrid1" runat="server"></asp:DataGrid>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>

后台代码:

Imports Microsoft.VisualBasic
Imports UlewooPage

Public Class _UsrMgr : Inherits Page

Public DbReader As Data.OleDb.OleDbDataReader
Public DataGrid1 As DataGrid
Public Label1 As Label

Public Sub Page_Load() If Not IsPostBack() Then
ShowList()
End If End Sub

Public Sub ShowList()
' 建立连接
Dim conn As Data.OleDb.OleDbConnection
conn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\database\sample.mdb")
conn.open()

' 获取当前页码
Dim strPage As String
strPage = CInt(Request.QueryString("Page"))
If String.IsNullOrEmpty(strPage) Then
strPage = "1"
End If
' 创建UlewooPage对象并显示页码的超链接
Dim uPage As UlewooPage
uPage = New UlewooPage(strPage, 20, conn, "Product", "id", "Name,Price")
Label1.Text = uPage.getNavInfo(True, "Page", "blackLink")
DbReader = uPage.getReader()
' 绑定数据
DataGrid1.DataSource = DbReader
DataGrid1.DataBind()
conn.Close()
DbReader.Close()
End Sub

End Class

超链接外观(见http://www.ulewoo.com页面底部)为:

浏览:389 下载:13

意见反馈 |  隐私条款 |  版权声明 |  站点地图
Copyright © 2009 Ulewoo.com 版权所有 转载须遵守版权声明 渝ICP备07003287号