So you have chosen to manipulate Excel spreadsheets with C#, and rather than using Excel Automation you are using OLEDB. Now you find you receive "Could not find installable ISAM" when bebugging.
I will bet it has to do with escaping the quotes surrounding the "Extended Properties" in your connection string. Personally, things worked fine for me util I added the HDR or IMEX variables.
The Excel references at www.connectionstrings.com are very helpful and indicate the quotes are an issue, but don't provide specific working examples.
Here you are:
String sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Test.xls;Extended Properties=\"Excel 8.0;HDR=No;IMEX=1;\"";
or maybe more helpfully:
String sFile = "C:\\Test.xls";
String sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + sFile + ";Extended Properties=\"Excel 8.0;HDR=No;IMEX=1;\"";
Notice the \" escapes surrounding Excel 8.0;HDR=No;IMEX=1;
Hope that helps.
Thank you friend. It was very helpful to me and solved my connectivity problem. Thanks a lot.
ReplyDeleteVery helpful! Thanks for the tip!
ReplyDeletevey very helpful. i was searching for this for a long time.
ReplyDeleteThank you very very much, indeed this was helpful.
ReplyDeleteThanks a lot, It was very useful
ReplyDeleteThanks a Lot..... It was very useful
ReplyDeleteThanks a TON for this post !Very Helpful.
ReplyDelete