Error External table is not in the expected format

I am trying to get data to sqlserver2005 on my C# windows application, from sheet1.xls file through oledb connection in visual studio-2008 and I am using windows7 os and I didn't installed excel on my system.

This is my connection string:

 string excelconnectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +excelfilepath + ";"+"Extended Properties='Excel 8.0;HDR=Yes;'";

I tried many ways but still i am getting this error :

"External table is not in the expected format. "

Please help me.

Answers


Use Microsoft.ACE.OLEDB.12.0 for excel files

string excelconnectionstring = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" +excelfilepath + ";"+"Extended Properties="Excel 12.0;HDR=Yes";

connectionstrings


Need Your Help

Can I restrict the installation of an enterprise app on an iOS device?

ios mdm airwatch

Supposedly AirWatch does allow this but I'm trying to find a solution using profiles and/or Apple Configurator.

Data Chart display

c# charts data-visualization

I want to display some values on graphic using a Chart in C#. I am using the following code