I am trying to establish a connection to an Access 2003 database I have
stored locally on my C:\ drive. However, everytime I try to run my code I get
the following error message.
An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in
system.data.dll
I've looked at several resources and have seen similar code. What am I
overlooking?
Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As System.
EventArgs) Handles btnLoad.Click
Dim dataset2 As New DataSet
dataset2 = New DataSet("dataset2")
Dim ConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;
Data Source = C:\AutoCAD Project\AutoCAD Files.mdb; User ID=Admin"
Dim Connection1 As OleDbConnection = New OleDbConnection
(ConnectionString)
Dim Command1 As OleDbCommand = New OleDbCommand("SELECT * FROM
AutoCAD Files", Connection1)
Connection1.Open()
Command1.Connection = Connection1
Dim daAdapter1 As OleDbDataAdapter = New OleDbDataAdapter
daAdapter1.SelectCommand = Command1
DataGrid1.Visible = True
daAdapter1.Fill(dataset2, "AutoCAD Files") * * *
ERROR MESSAGE STOPS HERE * * *
DataGrid1.SetDataBinding(dataset2, "AutoCAD Files")
End Sub
--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...b-net/200508/1