jennyflower
Programmer
Hi, Im am just really learning vb.net using visual studio 2003 and I am trying to get some data from SQL Server Express 2005 into my datagrid.
I currently have this:
Public Sub GridMyDataOle(ByVal myConnString As String)
Dim mySelectQuery As String = "SELECT TOP 10 h_order_no FROM order_header"
Dim myConnection As New OleDbConnection(myConnString)
Dim myCommand As New OleDbCommand(mySelectQuery, myConnection)
myConnection.Open()
Dim myAdapter As New OleDbDataAdapter(myCommand)
Dim myDataSet As New DataSet
myAdapter.Fill(myDataSet, "order_header")
Me.DataGrid1.SetDataBinding(myDataSet, "")
myConnection.Close()
End Sub 'Ole DB - GridMyDataOle
I get the data in the grid doing this but I want to do it without the user having to select the (+) key or any navigation.
None of the books I have read mention this part!
Thanks
I currently have this:
Public Sub GridMyDataOle(ByVal myConnString As String)
Dim mySelectQuery As String = "SELECT TOP 10 h_order_no FROM order_header"
Dim myConnection As New OleDbConnection(myConnString)
Dim myCommand As New OleDbCommand(mySelectQuery, myConnection)
myConnection.Open()
Dim myAdapter As New OleDbDataAdapter(myCommand)
Dim myDataSet As New DataSet
myAdapter.Fill(myDataSet, "order_header")
Me.DataGrid1.SetDataBinding(myDataSet, "")
myConnection.Close()
End Sub 'Ole DB - GridMyDataOle
I get the data in the grid doing this but I want to do it without the user having to select the (+) key or any navigation.
None of the books I have read mention this part!
Thanks