Imports System.Data.SqlClient
Imports System.Data
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
BindData()
End If
End Sub
Private Sub BindData()
Dim con As SqlConnection
con = New SqlConnection("Data Source=EMMU-PC;Initial Catalog=mendu;Integrated Security=True")
Dim cmd As SqlCommand
cmd = New SqlCommand("select * from mendu1", con)
Dim ad1 As SqlDataAdapter
ad1 = New SqlDataAdapter(cmd)
Dim ds As New DataSet
ad1.Fill(ds)
DataGrid1.DataSource = ds
DataGrid1.DataBind()
End Sub
Protected Sub DataGrid1_PageIndexChanged(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEventArgs) Handles DataGrid1.PageIndexChanged
DataGrid1.CurrentPageIndex = e.NewPageIndex
BindData()
End Sub
End Class
Default.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
Untitled Page
0 comments:
Post a Comment