zabzoo
New member
- Joined
- Sep 10, 2008
- Messages
- 3
- Programming Experience
- Beginner
VB.NET - Followed instructions to the letter but my DataGridView does not show the information in the database.
I have a DataGridView1 datagrid in Form1 and this is the code in my code page.
Things that i have checked -
I have a DataGridView1 datagrid in Form1 and this is the code in my code page.
VB.NET:
Dim conStr As String = _
"Provider=Microsoft.Jet.OLEDB.4.0;data source=H:\XXX\DATABASE\XXX.mdb"
Dim connection As OleDb.OleDbConnection = New OleDb.OleDbConnection(conStr)
'Create a data adapter
Dim sqlStr As String = "SELECT tbCompanyDetails.* FROM tbCompanyDetails"
'Instantiate a Data Adapter object
Dim da As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter(sqlStr, connection)
connection.Open()
Dim ds As DataSet = New DataSet
da.Fill(ds, "WebsiteDetails")
DataGridView1.DataSource = ds.DefaultViewManager
Things that i have checked -
- Imports System.Data.OleDb done at the top
- The code appears inside Private Sub Form1_load etc...
- The path to the database is correct
- The select statement works fine in a query window inside access
- I am not exactly sure what the "WebsiteDetails" part of this statement da.Fill(ds, "WebsiteDetails") does, so i made it descriptive based on my example -- i just chose website details because that is what's inside that table; not sure if was supposed to be a column name or something.