Can anyone tell me why my code is giving me System.Data.OleDb.OleDbException
and IErrorInfo.GetDescription failed with E_FAIL(0x80004005)
errors? They're at the same place. The error appears at the Reader = Command.ExecuteReader()
line. Here is my code:
If Not Page.IsPostBack Then
Dim Connection As OleDbConnection
Dim Command As OleDbCommand
Dim Reader As OleDbDataReader
Dim ConnectionString As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\KayJoy\Documents\University\UJ Official Documents\Informatics\2A\P02.accdb"
Connection = New OleDbConnection(ConnectionString)
Connection.Open()
Dim CommandString As String
CommandString = "SELECT * FROM Module"
Command = New OleDbCommand(CommandString, Connection)
Command.CommandType = CommandType.Text
Reader = Command.ExecuteReader()
If Reader.HasRows Then
Do While Reader.Read
Response.Write(Reader("M_Code") & ",")
Response.Write(Reader("M_Name") & ",")
Response.Write(Reader("M_Credit") & "<br/>")
Loop
End If
Command.Connection.Close()
Command.Dispose()
Connection.Dispose()
End If