【问题标题】:Error External table is not in the expected format错误外部表不是预期的格式
【发布时间】:2014-02-03 07:24:57
【问题描述】:

我正在尝试在我的C# windows 应用程序上将数据从 sheet1.xls 文件通过 Visual Studio-2008 中的 oledb 连接获取到 sqlserver2005,我正在使用 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. "

请帮帮我。

【问题讨论】:

    标签: c# excel oledb


    【解决方案1】:

    对 excel 文件使用 Microsoft.ACE.OLEDB.12.0

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

    connectionstrings

    【讨论】:

    • 我安装了 AccessDatabaseEngine.exe(Microsoft Access Database Engine 2010 Redistributable),我又试了一次,但仍然遇到同样的错误
    • 你能提供你的连接字符串@FADV
    • string excelconnectionstring = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + excelfilepath + ";" + "扩展属性='Excel 8.0;HDR=是;'";而excel文件路径为:C:\sheet1.xls
    • 我改变了你上面给出的字符串,但仍然有同样的问题。我使用的是旧版本的 .xls 格式(97-2003)
    • 您的 Excel 文件本身可能包含一些无效数据。这就是 OleDB 无法读取您的 Excel 工作表的原因。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-02
    • 1970-01-01
    • 2010-11-11
    • 2016-07-04
    相关资源
    最近更新 更多