ASP 101 - Active Server Pages 101 db_paging.aspx
<%@ Page Language="VB" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<script language="VB" runat="server">
	Sub Page_Load(sender as Object, e as EventArgs)
		If Not Page.IsPostBack Then
		End If
	End Sub
	Sub ShowDataGrid()
		Dim objConnection As SqlConnection
		Dim objCommand    As SqlCommand
		Dim objAdapter    As SqlDataAdapter
		Dim objDataSet    As DataSet
		Dim strSQLQuery   As String
		' Set up our connection.
		objConnection = New SqlConnection("Data Source=;" _
   & "Initial Catalog=samples;User Id=samples;Password=password;" _
   & "Connect Timeout=15;Network Library=dbmssocn;")
		' Set up our SQL query text.
		strSQLQuery = "SELECT * FROM sample"
		' Create new command object passing it our SQL query
		' and telling it which connection to use.
		objCommand = New SqlCommand(strSQLQuery, objConnection)
		' Get a DataSet to bind the DataGrid to
		objAdapter = New SqlDataAdapter(objCommand)
		objDataSet = New DataSet()
		' DataBind DG to DS
		dgPaging.DataSource = objDataSet
	End Sub
	Sub PageChange(sender As Object, e As DataGridPageChangedEventArgs)
		dgPaging.CurrentPageIndex = e.NewPageIndex
	End Sub
  <title>ASP.NET Database Paging Sample</title>
<form runat="server">
<!-- Plain vanilla DataGrid... format it as you like. -->
<asp:DataGrid id="dgPaging" runat="server"
  AllowPaging = "True"
  PageSize    = 10
  OnPageIndexChanged = "PageChange">
	<PagerStyle Mode="NumericPages" />
<hr />
Click <a href="">here</a>
to read about and download the source code.