Could not find installable ISAM

Posted by Sharpcnet under C# on 11/18/2013 | Points: 10 | Views : 8969 | Status : [Member] | Replies : 6
Using Windows 7 64 Bit OS, ASP.NET. When trying to read an excel file, It gives an error - 'Could not find installable ISAM'.
I tried to install AccessDatabaseEngineX64 but it said, the Office 2007 has 32 bit components, so went ahead & installed AccessDatabaseEngineX86. I also changed the Platform to 'X86' from 'Any CPU'. The issue persits. How can I fix it.
string fileName = fileUploadExcel.PostedFile.FileName;
string fileType = Path.GetExtension(fileName);
string filePath = "~/Temp/"+fileName;
FileUploadExcel.SaveAs(Server.MapPath(filePath));
string connString ="";

if(fileType==".xls")
connString = string.Format("Provider=Microsoft.ACE.OLEDB.12.0;DataSource={0};Extended Properties = \"Excel 8.0;HDR=Yes;IMEX=2\";",filePath);
else if(fileType==".xlsx")
connString = string.Format("Provider=Microsoft.ACE.OLEDB.12.0;DataSource={0};Extended Properties = \"Excel 12.0;HDR=Yes;IMEX=2\";",filePath);

DataTable dt = new DataTable();
OleDbConnection conn = new OleDbConnection(connString);
conn.Open; //Error Here





Responses

Posted by: vishalneeraj-24503 on: 11/18/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Hi,

Have you given the right connection string?

i think you have written wrong connection string, thatswhy connection is not opening.

please check that one.

Sharpcnet, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sharpcnet on: 11/18/2013 [Member] Starter | Points: 25

Up
0
Down
Hi, I am trying various suggestions online. Could you suggest the right one.

Sharpcnet, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sharpcnet on: 11/18/2013 [Member] Starter | Points: 25

Up
0
Down
I figured it out from http://social.msdn.microsoft.com/Forums/en-US/55d9545e-073e-4a24-bf04-f1ce16429ad4/could-not-find-installable-isam-with-excel-file

The error was 'DataSource'. It should be 'Data Source' instead.

Sharpcnet, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Allemahesh on: 11/18/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
Dear Sharpcnet,

You are right, the issue is with your connString. Replace the below one with new one

connString = string.Format("Provider=Microsoft.ACE.OLEDB.12.0;DataSource={0};ExtendedProperties = \"Excel 12.0;HDR=Yes;IMEX=2\";",filePath);


Replace this with new one:-

connString = string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source ={0};Extended Properties = \"Excel 12.0;HDR=Yes;IMEX=2\";", filePath);


Complete code :-

string fileName = fileUploadExcel.PostedFile.FileName;
string fileType = Path.GetExtension(fileName);
string filePath = Server.MapPath("~/Temp/") + fileName;
fileUploadExcel.SaveAs(filePath);
string connString = "";

if (fileType == ".xls")
connString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties = \"Excel 8.0;HDR=Yes;IMEX=2\";", filePath);
else if (fileType == ".xlsx")
connString = string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties = \"Excel 12.0 xml;HDR=Yes;IMEX=2\";", filePath);

DataTable dt = new DataTable();
OleDbConnection conn = new OleDbConnection(connString);
conn.Open();
dt = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);

if (dt != null)
{
int count = dt.Rows.Count; //The count is 0 here
foreach (DataRow row in dt.Rows)
{
string sheetName = row["TABLE_NAME"].ToString();
}
}



Happy Coding,
If it helps you or directs U towards the solution, MARK IT AS ANSWER

Sharpcnet, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bandi on: 11/20/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Refer this link
http://stackoverflow.com/questions/11562267/system-data-oledb-oledbexception-could-not-find-installable-isam


Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Sharpcnet, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bandi on: 11/20/2013 [Member] [MVP] Platinum | Points: 25

Login to post response