我正在尝试通过 visual studio-2008 中的 oledb 连接从 sheet1.xls 文件获取数据到 sqlserver2005
我的 C#
应用程序,我使用的是 windows7 操作系统而且我没有在我的系统上安装 excel。
这是我的连接字符串:
string excelconnectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +excelfilepath + ";"+"Extended Properties='Excel 8.0;HDR=Yes;'";
我尝试了很多方法,但仍然出现此错误:
"External table is not in the expected format. "
请帮帮我。
最佳答案
对 excel 文件使用 Microsoft.ACE.OLEDB.12.0
string excelconnectionstring = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" +excelfilepath + ";"+"Extended Properties="Excel 12.0;HDR=Yes";
关于c# - 错误外部表不是预期的格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21521817/