Click here to Skip to main content
15,041,025 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everybody....

I am getting the following error when i am filling dataset from dataadapter after retrieving data from the MS-Access database.

"IErrorInfo.GetDescription failed with E_FAIL(0x80004005)"

following is the code i used to fill dataset and bind to gridview.

C#
OleDbCommand cmd1 = new OleDbCommand("Select ID, PrjctName from Current", con);
OleDbDataAdapter da1 = new OleDbDataAdapter(cmd1);
DataSet ds1 = new DataSet();
da1.Fill(ds1);
Grid_Current.DataSource = ds1;
Grid_Current.DataBind();
Posted
Updated 11-Nov-11 20:39pm
v2

It is the occoured due to MSAccess database.

use following Query
SQL
Select [ID], PrjctName from Current
   
Insert Bracket and try once more .......

OleDbCommand cmd1 = new OleDbCommand("Select [ID], [PrjctName] from Current", con);
OleDbDataAdapter da1 = new OleDbDataAdapter(cmd1);
DataSet ds1 = new DataSet();
da1.Fill(ds1);
Grid_Current.DataSource = ds1;
Grid_Current.DataBind();

inform whether error Comes or not?
   
Comments
abhishekagrwl25 12-Nov-11 3:15am
   
Yes still m getting the same error....:(
Actually this error occurred because of the reserved word of MS Access. And also its always a best practice to use Square brackets[] around the field names & table names. Like below
SQL
Select [ID], [PrjctName] from [Current]

Now try this.

FYI List of reserved words in Microsoft Access 97, 2002, 2002 and Access 2003[^]
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900