how 2 do it in VB.NET?
i want to connect to a sql db and fill a datagrid with the result of my query
it's pretty different from vb6 :-/
Printable View
how 2 do it in VB.NET?
i want to connect to a sql db and fill a datagrid with the result of my query
it's pretty different from vb6 :-/
I dont have my SQL example here..but you can find plenty of examples here
http://www.gotdotnet.com
Dim oconn As SqlConnection = New SqlConnection()
Dim ocmd As SqlCommand = New SqlCommand()
Dim oDA As SqlDataAdapter = New SqlDataAdapter()
Dim oDS As DataSet = New DataSet()
oconn.ConnectionString = ".........."
oconn.Open()
ocmd.Connection = oconn
ocmd.CommandText = "........."
oDA.SelectCommand = ocmd
oDA.Fill(oDS, "customers")
DataGrid1.SetDataBinding(oDS, "Customers")