Datareader error

HI,

has anyone encountered the " IErrorInfo.GetDescription failed with E_FAIL(0x80004005)" error before. I get this error when I use oledbdatareader with access2000.

the detail of the error is;

System.Data.OleDb.OleDbException: IErrorInfo.GetDescription failed with E_FAIL(0x80004005). at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr) at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) at System.Data.OleDb.OleDbCommand.ExecuteReader() at WeaponShop.frmUpSchedule.Page_Load(Object sender, EventArgs e) in

could anyone hep to get rid of this error?

ayha
LVL 7
ayha1999Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

JessyEzzyCommented:
It would help if you post the code where you get the error
ayha1999Author Commented:
Hi,

this is complete code;

 Private Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        QID = Request.QueryString("IntID")
    Dim con As OleDbConnection = New OleDbConnection(ConfigurationSettings.AppSettings("connectionString"))

        Dim str As String = "select Schedules.*,UnitName,Interval from (Schedules LEFT JOIN Units ON Schedules.UnitCode=Units.UnitCode)LEFT JOIN MaintInt ON Schedules.SInt=MaintInt.IntID Where SchID=@IntID"
        Dim cmd As OleDbCommand = New OleDbCommand(str, con)
      ...
               con.Open()
           Try
            Dim dr As OleDbDataReader = cmd.ExecuteReader()
            If dr.Read Then
                txtSchID.Text = QID
                txtUnit.Text = dr.Item("UnitName")

                txtBegDate.Text = DateTime.Parse(dr.Item("FromDate")).ToShortDateString
                txtEndDate.Text = DateTime.Parse(dr.Item("ToDate")).ToShortDateString

                Dim lstMID As ListItem = ddlMaintInt.Items.FindByText(CStr(dr.Item("Interval")))
                If lstMID Is Nothing Then
                    lstMID.Selected = True
                End If

                txtSpReq.Text = dr.Item("Req")
                txtRemarks.Text = dr.Item("Remarks")
            End If

        Catch ex As OleDbException
         ...
        Finally
         ...
        End Try
    End Sub

ayha
JessyEzzyCommented:
You are receiving the error at this line "Dim dr As OleDbDataReader = cmd.ExecuteReader()" ?

one more thing you said that you receive the error when you use oledbdatareader with Access 2000, does this mean that you tried something else and it worked but now it's not working with access 2000?
Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

ayha1999Author Commented:
Hi,

I just get this error at 'cmd.executereader(). I didn't try anything else.

ayha
JessyEzzyCommented:
Having an error at the line executing the reader usually means that there is something wrong with the query itself, I noticed in your code that you are not passing the value of the parameter IntID, another thing with Oledb we use the ? as a palceholder for the input parameter, so you query would be something like this

Dim str As String = "select Schedules.*,UnitName,Interval from (Schedules LEFT JOIN Units ON Schedules.UnitCode=Units.UnitCode)LEFT JOIN MaintInt ON Schedules.SInt=MaintInt.IntID Where SchID= ?"

cmd.CommandType = CommandType.Text
cmd.Parameters.Add("@SchID",OleDbType.Integer).Value = ' your required value

if this didn't help, try executing your query as it is in the access and see what errors it will report to you

HTH Jessy
ayha1999Author Commented:
Hi JessyEzzy,

The error was the word 'Interval' in the query. I just changed the name to some other name and it worked. When I executed the query with Interval in the access query it was working fine. I think the datareader doesn't recognize the 'INterval' as a field name.

thanks for your interest.

ayha
JessyEzzyCommented:
Glad to hear you solve it.

Good Luck.
LunchyCommented:
Closed, 250 points refunded.
Lunchy
Friendly Neighbourhood Community Support Admin

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.