How to bind data to Datagrid or Gridview in vb.net using DataBind()
Private Sub Page_Load(....) Handles MyBase.Load
'Put user code to initialize the page here
Dim con As New SqlClient.SqlConnection("Data Source=SERVER;Initial Catalog=ERP;Integrated Security=True")
Dim com As New SqlClient.SqlCommand
Dim ds As New DataSet
Dim da As New SqlDataAdapter
da = New SqlDataAdapter("select scode,fname,prod1,prod2,prod3,prod4 from Supplier_Master", con)
da.Fill(ds, "Stock")
dgsupp.DataSource = ds.Tables("Stock")
dgsupp.DataBind()
End Sub
Private Sub Page_Load(....) Handles MyBase.Load
'Put user code to initialize the page here
Dim con As New SqlClient.SqlConnection("Data Source=SERVER;Initial Catalog=ERP;Integrated Security=True")
Dim com As New SqlClient.SqlCommand
Dim ds As New DataSet
Dim da As New SqlDataAdapter
da = New SqlDataAdapter("select scode,fname,prod1,prod2,prod3,prod4 from Supplier_Master", con)
da.Fill(ds, "Stock")
dgsupp.DataSource = ds.Tables("Stock")
dgsupp.DataBind()
End Sub
0 comments: