Quantcast
Channel: Oracle, MySQL, Sybase, Informix and other databases
Viewing all articles
Browse latest Browse all 1350

Problem with OleDbConnection open - Excel files .xls or .xlsx

$
0
0

In my application i am making user to upload the excel file. While uploading the excel file i am getting this error "No error message available, result code: E_FAIL(0x8000FFFF). at ". but not all the time this error is coming. sometime this error is coming.I am not able to trace...

Error : No error message available, result code: E_UNEXPECTED(0x8000FFFF)

Code i am using : 

if (fileExtension.ToLower() == ".xls")
{
headerConn = ("Provider=Microsoft.Jet.OLEDB.4.0;" +
("Data Source=" + filepath + ";" +
"Extended Properties=\"Excel 8.0;HDR=Yes;\""));

conn = ("Provider=Microsoft.Jet.OLEDB.4.0;" +
("Data Source=" + filepath + ";" +
"Extended Properties=\"Excel 8.0;HDR=No;\""));

}
else if (fileExtension.ToLower() == ".xlsx")
{
headerConn = ("Provider=Microsoft.ACE.OLEDB.12.0;" +
("Data Source=" + filepath + ";" +
"Extended Properties=\"Excel 8.0;HDR=Yes;\""));

conn = ("Provider=Microsoft.ACE.OLEDB.12.0;" +
("Data Source=" + filepath + ";" +
"Extended Properties=\"Excel 12.0;HDR=No;\"")); //IMEX=1;


}
using (OleDbConnection oleCon = new OleDbConnection(conn))
{

oleCon.Open(); // Getting here during connection open some times.

DataTable tbSheetNames = oleCon.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);

oleCon.Close();

}

Please any body get me out from here i stuck here last from many days, i will really appreciate.

Thanks

Azad


Viewing all articles
Browse latest Browse all 1350

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>