0

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
YowE3K
  • 23,852
  • 7
  • 26
  • 40
Sophie
  • 9
  • 3
  • 1
    Try to enclose the word `Module` in square brackets. `SELECT * FROM [Module]` – ɐsɹǝʌ ǝɔıʌ Oct 16 '17 at 07:07
  • 1
    Possible duplicate of [What is causing my OLEDbException, IErrorInfo.GetDescription failed with E\_FAIL(0x80004005)](https://stackoverflow.com/questions/15534284/what-is-causing-my-oledbexception-ierrorinfo-getdescription-failed-with-e-fail) – MatSnow Oct 16 '17 at 08:23
  • It works now, thank you! @equisde – Sophie Oct 16 '17 at 19:09

0 Answers0