I am trying to load a database table into a datagrid. I have already tried several snippets and methods and I keep getting the same result: nothing shows up...
Here's my code:
The table's name is correct, in Access the same query returns results, in VS.NET 2005 the datagrid does not get filled up. Any ideas?
Thanks
Here's my code:
Code:
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim connString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\StudentInformation.mdb"
Dim myConnection As OleDbConnection = New OleDbConnection
myConnection.ConnectionString = connString
' create a data adapter
Dim da As OleDbDataAdapter = New OleDbDataAdapter("Select * from Table1", myConnection)
' create a new dataset
Dim ds As DataSet = New DataSet
' fill dataset
da.Fill(ds, "Table1")
' Attach DataSet to DataGrid
DataGrid1.DataSource = ds.DefaultViewManager
End Sub
The table's name is correct, in Access the same query returns results, in VS.NET 2005 the datagrid does not get filled up. Any ideas?
Thanks