<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Data" %>
<Script Runat="Server">
Dim conNorthwind As SqlConnection
Dim strSelect As String
Dim intStartIndex As Integer
Dim intEndIndex As Integer
Sub Page_Load
Dim cmdSelect As SqlCommand
btnFirst.Text = "首页"
btnPrev.Text = "上一页"
btnNext.Text = "下一页"
btnLast.Text = "末页"
conNorthwind = New SqlConnection( "Server=192.168.4.1;UID=sa;PWD=XXXXXX;Database=NorthWind" )
If Not IsPostBack Then
' Get Total Pages
strSelect = "SELECT COUNT(OrderID) FROM Orders"
cmdSelect = New SqlCommand( strSelect, conNorthwind )
conNorthwind.Open()
dgrdProducts.VirtualItemCount = (cmdSelect.ExecuteScalar() / dgrdProducts.PageSize