Jan 11, 2011

External table is not in the expected format

I got this error while I was writing down a small utility to import data from excel. The error was in connection string which I used:
strdbConn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" +
                                strFilePath
                                + "; Jet OLEDB:Engine Type=5;"
                                + "Extended Properties=Excel 8.0;";
 
Now I had windows 7 x64 bit and similarly Office 2010 professional plus and the above connection string didn't work.
Resolution:
Finally you need to use the following connection string in here:
 
strdbConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" 
+ strFilePath + 
";Extended Properties=Excel 12.0;";
 
And the error was resolved!

No comments:

Post a Comment