Does anyone know what cause this error message? System.Data.OleDb.OleDbException: IErrorInfo.GetDescription failed with E_FAIL(0x80004005).
I'm try to read and get the data from the access database but gets this error message:
IErrorInfo.GetDescription failed with E_FAIL(0x80004005).
The connection to the database is opened and the fields in the table are correct. I used the same method connection to read the same database and it works, but when I create another function to read the same database but different table and it failed with the
error message above. Does anyone knows why and how do I fix this?
olaamigos
Member
45 Points
294 Posts
Error: IErrorInfo.GetDescription failed with E_FAIL(0x80004005)
Feb 26, 2008 09:26 PM|LINK
Hello everyone,
Does anyone know what cause this error message? System.Data.OleDb.OleDbException: IErrorInfo.GetDescription failed with E_FAIL(0x80004005).
I'm try to read and get the data from the access database but gets this error message: IErrorInfo.GetDescription failed with E_FAIL(0x80004005).
The connection to the database is opened and the fields in the table are correct. I used the same method connection to read the same database and it works, but when I create another function to read the same database but different table and it failed with the error message above. Does anyone knows why and how do I fix this?
Here are my sample query and db information:
access db: statement.mdb
access table: PersonalStatement
Read FieldName: IdNum
private string GetSiteUsage(string sIdNum)
{
string mySelectQuery;
string myConnString;
string ReturnCategories;
string username;
OleDbConnection myConnection;
OleDbCommand myCommand;
username = Session["user"].ToString();
mySelectQuery = "Select statement from PersonalStatement where IdNum= " + "'" + sIdNum + "'";
myConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + ConfigurationManager.AppSettings.Get("RootDir") + username + ConfigurationManager.AppSettings.Get("DbStatement");
myConnection = new OleDbConnection(myConnString);
myCommand = new OleDbCommand(mySelectQuery, myConnection);
myCommand.Parameters.AddWithValue("IdNum", sIdNum);
myConnection.Open();
object ReturnVal = myCommand.ExecuteScalar(); //ERROR: IErrorInfo.GetDescription failed with E_FAIL(0x80004005)
if
{
}
else
{
}
return RetVal;
GavH
Member
194 Points
83 Posts
Re: Error: IErrorInfo.GetDescription failed with E_FAIL(0x80004005)
Feb 26, 2008 10:15 PM|LINK
statement may be a reserved word, it is in several dbms try putting [] around it :
mySelectQuery = "Select [statement] from PersonalStatement where IdNum= " + "'" + sIdNum + "'";
olaamigos
Member
45 Points
294 Posts
Re: Error: IErrorInfo.GetDescription failed with E_FAIL(0x80004005)
Feb 27, 2008 02:23 AM|LINK
Thanks GavH for your work, I got it works now, thanks
ervipingupta
Member
17 Points
75 Posts
Re: Error: IErrorInfo.GetDescription failed with E_FAIL(0x80004005)
Dec 04, 2009 10:45 AM|LINK
Thanks this is working fine ......................awesome post !!!!
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + datasource + "Extended Properties=Excel 8.0;";
//strConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + datasource + ";Extended Properties=Excel 12.0;";
OleDbDataAdapter myCommand = new OleDbDataAdapter("SELECT [language],[subcategory],[catid],[supercatname],[itemname],[filename],[album],[albumid],[label],[musicdirector],[singer],[lyricist],[actor],[mp3],[amr],[mid],[fulltrack],[status] FROM [sheet1$]", strConn);
DataSet myDataSet = new DataSet();
myCommand.Fill(myDataSet, "ExcelInfo");