Dim Service As New WebService1
Dim ConnStr As String = "server=(local);database=police;uid=police;password=police"
Dim Conn As New SqlConnection(ConnStr)
Dim strPeID As String = ""
Dim Sql As String
'Dim Sql As String = "SELECT * FROM TblPersonel"
Dim Cmd As SqlCommand
'Dim Idx As String = Request.QueryString("id")
Dim MyDa As New SqlDataAdapter(Sql, Conn)
Dim Da As New SqlDataAdapter
Dim Ds As New DataSet
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Conn.Open()
'If Not Page.IsPostBack Then
If Not (IsPostBack) Then
GridViewBindData()
ReadSIdToDdl()
End If
End Sub
Protected Sub GridViewBindData()
Sql = "SELECT * FROM TblPersonel"
Dim dtReader As SqlDataReader
Cmd = New SqlCommand(Sql, Conn)
dtReader = Cmd.ExecuteReader()
'*** BindData to GridView ***'
GridView1.DataSource = dtReader
GridView1.DataBind()
dtReader.Close()
dtReader = Nothing
End Sub
Private Sub GridView1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles GridView1.PageIndexChanging
GridView1.PageIndex = e.NewPageIndex
GridViewBindData()
End Sub
Dim Service As New WebService1
Dim ConnStr As String = "server=(local);database=police;uid=police;password=police"
Dim Conn As New SqlConnection(ConnStr)
Dim strPeID As String = ""
Dim Sql As String
Dim Cmd As SqlCommand
Dim MyDa As New SqlDataAdapter(Sql, Conn)
Dim Da As New SqlDataAdapter
Dim Ds As New DataSet
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
ReadSIdToDdl()
End If
Dim dt As DataTable
'*** DataTable ***'
dt = CreateDataTable()
'*** BindData to GridView ***'
GridView1.DataSource = dt
GridView1.DataBind()
End Sub
'*** DataTable ***'
Function CreateDataTable() As DataTable
Dim objConn As New SqlConnection
Dim dtAdapter As SqlDataAdapter
Dim dt As New DataTable
Dim strConnString As String
strConnString = "server=(local);database=police;uid=police;password=police"
Conn = New SqlConnection(strConnString)
Conn.Open()
Dim strSQL As String
strSQL = "SELECT * FROM TblPersonel"
dtAdapter = New SqlDataAdapter(strSQL, Conn)
dtAdapter.Fill(dt)
dtAdapter = Nothing
objConn.Close()
objConn = Nothing
Return dt '*** Return DataTable ***'
End Function
Private Sub GridView1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles GridView1.PageIndexChanging
GridView1.PageIndex = e.NewPageIndex
' GridViewBindData()
CreateDataTable()
End Sub
If Not Page.IsPostBack Then
ReadSIdToDdl()
Dim dt As DataTable
'*** DataTable ***'
dt = CreateDataTable()
'*** BindData to GridView ***'
GridView1.DataSource = dt
GridView1.DataBind()
End If
If Not Page.IsPostBack Then
ReadSIdToDdl()
Dim dt As DataTable
'*** DataTable ***'
dt = CreateDataTable()
'*** BindData to GridView ***'
GridView1.DataSource = dt
GridView1.DataBind()
End If
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
GridView1.AllowPaging = true
GridView1.PageSize = 50
If Not Page.IsPostBack Then
GridView1.DataSource = CreateDataTable()
GridView1.DataBind()
ReadSIdToDdl()
End If
End Sub
Protected Sub GridView1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles GridView1.PageIndexChanging
GridView1.DataSource = CreateDataTable()
GridView1.PageIndex = e.NewPageIndex
GridView1.DataBind()
End Sub
Protected Function CreateDataTable() As DataTable
Dim strConnString As String = "server=(local);database=police;uid=police;password=police"
Dim objConn As New SqlConnection(strConnString)
Dim strCmdString As String = "SELECT * FROM [TblPersonel]"
Dim objCmd As New SqlCommand(strCmdString, objConn)
Dim Dt As New DataTable()
Dim objAdapter As New SqlDataAdapter(objCmd)
objAdapter.Fill(Dt)
Return Dt '*** Return DataTable ***'
End Function