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>
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>