ayha1999
asked on
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.OleDbExc eption: IErrorInfo.GetDescription failed with E_FAIL(0x80004005). at System.Data.OleDb.OleDbCom mand.Execu teCommandT extErrorHa ndling(Int 32 hr) at System.Data.OleDb.OleDbCom mand.Execu teCommandT extForSing leResult(t agDBPARAMS dbParams, Object& executeResult) at System.Data.OleDb.OleDbCom mand.Execu teCommandT ext(Object & executeResult) at System.Data.OleDb.OleDbCom mand.Execu teCommand( CommandBeh avior behavior, Object& executeResult) at System.Data.OleDb.OleDbCom mand.Execu teReaderIn ternal(Com mandBehavi or behavior, String method) at System.Data.OleDb.OleDbCom mand.Execu teReader(C ommandBeha vior behavior) at System.Data.OleDb.OleDbCom mand.Execu teReader() at WeaponShop.frmUpSchedule.P age_Load(O bject sender, EventArgs e) in
could anyone hep to get rid of this error?
ayha
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.OleDbExc
could anyone hep to get rid of this error?
ayha
It would help if you post the code where you get the error
ASKER
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(Configurat ionSetting s.AppSetti ngs("conne ctionStrin g"))
Dim str As String = "select Schedules.*,UnitName,Inter val from (Schedules LEFT JOIN Units ON Schedules.UnitCode=Units.U nitCode)LE FT JOIN MaintInt ON Schedules.SInt=MaintInt.In tID 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("Fr omDate")). ToShortDat eString
txtEndDate.Text = DateTime.Parse(dr.Item("To Date")).To ShortDateS tring
Dim lstMID As ListItem = ddlMaintInt.Items.FindByTe xt(CStr(dr .Item("Int erval")))
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
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(Configurat
Dim str As String = "select Schedules.*,UnitName,Inter
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("Fr
txtEndDate.Text = DateTime.Parse(dr.Item("To
Dim lstMID As ListItem = ddlMaintInt.Items.FindByTe
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
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?
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?
ASKER
Hi,
I just get this error at 'cmd.executereader(). I didn't try anything else.
ayha
I just get this error at 'cmd.executereader(). I didn't try anything else.
ayha
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,Inter val from (Schedules LEFT JOIN Units ON Schedules.UnitCode=Units.U nitCode)LE FT JOIN MaintInt ON Schedules.SInt=MaintInt.In tID Where SchID= ?"
cmd.CommandType = CommandType.Text
cmd.Parameters.Add("@SchID ",OleDbTyp e.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
Dim str As String = "select Schedules.*,UnitName,Inter
cmd.CommandType = CommandType.Text
cmd.Parameters.Add("@SchID
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
ASKER
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
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
Glad to hear you solve it.
Good Luck.
Good Luck.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.