Manoj Kumar

Manoj Kumar

  • NA
  • 1
  • 17.2k

System.Data.OleDb.OleDbException: IErrorInfo.GetDescription failed with E_FAIL(0x80004005).

Nov 26 2010 12:57 AM

Hai Everyone,

I got the error from my Code ,

System.Data.OleDb.OleDbException: IErrorInfo.GetDescription failed with E_FAIL(0x80004005).

to the below coding

string connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filename + ";Extended Properties='Excel 8.0;HDR=YES;IMEX=1'";
   
string strSQL = " BEGIN TRY BEGIN TRANSACTION TRUNCATE TABLE emp INSERT INTO emp SELECT * FROM [Data$] COMMIT TRANSACTION END TRY BEGIN CATCH IF XACT_STATE() <> 0 ROLLBACK TRANSACTION; END CATCH";

OleDbConnection excelConnection = new OleDbConnection(connectionString);
  excelConnection.Open(); 
OleDbCommand dbCommand = new OleDbCommand(strSQL, excelConnection);
OleDbDataAdapter dataAdapter = new OleDbDataAdapter(dbCommand);
   
DataTable dTable = new DataTable();

dataAdapter.Fill(dTable);


What should i do will any one help me to solve the code.