1.页面调用
<%@ Register TagPrefix="cc1" Namespace="Pager" Assembly="Pager" %><%@ Register TagPrefix="cc1" Namespace="Pager" Assembly="Pager" %><%@ Register TagPrefix="cc1" Namespace="Pager" Assembly="Pager" %>
<cc1:aspnetpager id="AspNetPager" Visible="False" runat="server" Width="100%" CustomInfoClass="subhead" ShowCustomInfoSection="Right" NumericButtonCount="10" PageSize="5">
2.
设置属性信息
            Dim intPageCount As Integer = intRows * intColumns

            If Not Page.IsPostBack Then
                Me.AspNetPager.PageSize = intPageCount
            End If

 Me.AspNetPager.RecordCount = intTotalCount

            Me.AspNetPager.CustomInfoText = "记录总数:<font color=blue><b>" & Me.AspNetPager.RecordCount.ToString() & "</b></font>"

            Me.AspNetPager.CustomInfoText &= " 总页数:<font color=blue><b>" & Me.AspNetPager.PageCount.ToString() & "</b></font>"

            Me.AspNetPager.CustomInfoText &= " 当前页:<font color=red><b>" & Me.AspNetPager.CurrentPageIndex.ToString() & "</b></font>"

事件:
Private Sub AspNetPager_PageChanged(ByVal src As System.Object, ByVal e As Pager.PageChangedEventArgs) Handles AspNetPager.PageChanged
            AspNetPager.CurrentPageIndex = e.NewPageIndex
            BindData()
        End Sub

3.编写分页的存储过程
CREATE PROCEDURE aaa_GetPagebbb
@PageSize int,
@CurrentPage int,
@ModuleId int

 AS

--声明要执行的SQL字符串变量
declare @sqlstring  nvarchar(2000)

set @sqlstring= N'

--临时表
declare @indextable table(id int identity(1,1),nid int )

--当前页面的编号
declare @PageLowerBound int

declare @PageUpperBound int

set @PageLowerBound = (' + cast(@CurrentPage as nvarchar) +  '-1)*' + cast(@PageSize as nvarchar) + '

set @PageUpperBound =@PageLowerBound +' + cast(@PageSize as nvarchar) + '

--往临时表中写入ID编号
insert into @indextable(nid) select bbbID from bbb '  + '

select count(*) from @indextable  '

+ '
select *  '

set @sqlstring = @sqlstring  +  '
  from bbb, @indextable as t  where bbb.bbbID = t.nid '

if @PageSize <> 0
--@PageSize = 0 表示读取所有信息
begin
set @sqlstring = @sqlstring + 'and t.id > @PageLowerBound and t.id <= @PageUpperBound '
end

set @sqlstring = @sqlstring  + 'order by t.id '

print(@sqlstring)

exec (@sqlstring)
(切莫忘了最后执行的语句())
GO