IErrorInfo.GetDescription failed with E_FAIL(0x80004005)

J

JimO

I'm working through this Wrox book chapter about .Net data access. I'm
using an Access Database and I keep getting this error when using the
OleDbCommand and OleDbDataAdapter. It works as a stored procedure but not
as a query from the program.

IErrorInfo.GetDescription failed with E_FAIL(0x80004005)

I got the query right from the Query View of Access.

I googled this error and it seems to be pretty common but I still can't find
a reply with an answer.

Here is the code...


<body>

<span id='dbConn' runat="server"></span><br /><br />
<span id='query' runat="server"></span><br /><br /><br />
<span id="outError" runat="server"></span><br /><br /><br />
<asp:datagrid id="dgrOutput" runat="server"></asp:datagrid>

<script language="VB" runat="server">

Sub Page_Load()

Dim sConnection As String = Application("sDBConnection")
Dim sSQL As String = "SELECT tblWeek.Week, tblVocabulary.Word,
tblVocabulary.Pronunciation, tblDefinitions.Usage, tblDefinitions.Definition
"
sSQL += "FROM tblWeek INNER JOIN (tblVocabulary INNER JOIN
tblDefinitions ON (tblVocabulary.WordID = tblDefinitions.WordID) AND
(tblVocabulary.WordID = tblDefinitions.WordID)) ON tblWeek.Week =
tblVocabulary.Week "
sSQL += "ORDER BY tblWeek.Week, tblVocabulary.WordID;"
dbConn.InnerText = sConnection
query.InnerText = sSQL

Dim objDataSet as new DataSet()

Try

Dim objConnect As New OleDbConnection(sConnection)
Dim objCommand As New OleDbCommand

objCommand.Connection = objConnect
objCommand.CommandType = CommandType.Text
objCommand.CommandText = sSQL

Dim objDataAdapter As New OleDbDataAdapter()
objDataAdapter.SelectCommand = objCommand
objDataAdapter.Fill(objDataSet, "Defs")


Catch objError As Exception


outError.innerHTML = "<b>* Error while accesing data</b>.<br />" _
& objError.Message & "<br />" & objError.Source
Exit Sub ' and stop execution

End Try

dgrOutput.DataSource = objDataSet.Tables
dgrOutput.DataBind()

End Sub

</script>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top