Imports System
Imports System.Data
Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page
Dim strConnString As String = ConfigurationManager.ConnectionStrings("ConnString").ConnectionString
Dim Conn As SqlConnection
Dim Cmd As SqlCommand
Dim sql As String
Dim reader As SqlDataReader
Sub setYear()
System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture("en-US")
System.Threading.Thread.CurrentThread.CurrentUICulture = System.Threading.Thread.CurrentThread.CurrentCulture
End Sub
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not IsPostBack Then
bindata()
End If
setYear()
End Sub
Sub bindata()
Dim con As New SqlConnection(strConnString)
Dim dt As New DataTable()
Dim query As String = " SELECT id, num_material, name_material, area, input_dt, lot, supplier, obj FROM obj_tbl "
Dim objda As New SqlDataAdapter(query, con)
con.Open()
objda.Fill(dt)
objda = Nothing
If dt.Rows.Count > 0 Then
GridView1.DataSource = dt
GridView1.DataBind()
End If
con.Close()
End Sub
Protected Sub GridView1_PageIndexChanging(sender As Object, e As GridViewPageEventArgs)
GridView1.PageIndex = e.NewPageIndex
bindata()
End Sub
End Class