richarddenton
Member
- Joined
- Jul 31, 2006
- Messages
- 5
- Programming Experience
- Beginner
Hi,
I have set up my connection to an Access Database as per the code below (which I am pretty sure is fine as it is just copied from MSDN) but when I run the form it doesn't display the data. Am I missing out something obvious? At present I have nothing else on my form. Thanks in advance.
Dim DS As System.Data.DataSet
Dim MyCommand As System.Data.OleDb.OleDbDataAdapter
Dim MyConnection As System.Data.OleDb.OleDbConnection
MyConnection = New System.Data.OleDb.OleDbConnection( _
"provider=Microsoft.Jet.OLEDB.4.0; " & _
"data source=C:\Student Database.MDB")
MyCommand = New System.Data.OleDb.OleDbDataAdapter( _
"select * from tblResults", MyConnection)
DS = New System.Data.DataSet()
MyCommand.Fill(DS)
grdResults.DataSource = DS
MyConnection.Close()
I have set up my connection to an Access Database as per the code below (which I am pretty sure is fine as it is just copied from MSDN) but when I run the form it doesn't display the data. Am I missing out something obvious? At present I have nothing else on my form. Thanks in advance.
Dim DS As System.Data.DataSet
Dim MyCommand As System.Data.OleDb.OleDbDataAdapter
Dim MyConnection As System.Data.OleDb.OleDbConnection
MyConnection = New System.Data.OleDb.OleDbConnection( _
"provider=Microsoft.Jet.OLEDB.4.0; " & _
"data source=C:\Student Database.MDB")
MyCommand = New System.Data.OleDb.OleDbDataAdapter( _
"select * from tblResults", MyConnection)
DS = New System.Data.DataSet()
MyCommand.Fill(DS)
grdResults.DataSource = DS
MyConnection.Close()