I tried using OLEDB to connect to my access database. But i get some error when i tried to run the application.
Under the line myReader = myCommand.ExecuteReader() it gave me an error saying that
An unhandled exception of type System.Data.OleDb.OleDbException occurred in system.data.dll
How can i solved this problem ?
Under the line myReader = myCommand.ExecuteReader() it gave me an error saying that
An unhandled exception of type System.Data.OleDb.OleDbException occurred in system.data.dll
How can i solved this problem ?
Code:
Dim myConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Inetpub\wwwroot\KW\db1.mdb"
Dim mySelectQuery As String = "SELECT * FROM User"
Dim myConnection As New OleDbConnection(myConnString)
Dim myCommand As New OleDbCommand(mySelectQuery, myConnection)
myConnection.Open()
Dim myReader As OleDbDataReader
myReader = myCommand.ExecuteReader()
While myReader.Read()
Console.WriteLine(myReader.GetInt32(0).ToString() + ", " _
+ myReader.GetString(1))
End While
myReader.Close()
myConnection.Close()