1
        string fileName = "e:\\investigation\\report.xlsx";
        string SHEETNAME_HERE = "Sheet1";
        string connectionString = String.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=\"Excel 8.0;HDR=YES\";", fileName);
        OleDbConnection con = new OleDbConnection(connectionString);
        StringBuilder stbQuery = new StringBuilder();
        stbQuery.Append("SELECT * FROM [" + SHEETNAME_HERE + "]");
        OleDbDataAdapter adp = new OleDbDataAdapter(stbQuery.ToString(), con);

        DataSet dsXLS = new DataSet();
        adp.Fill(dsXLS);

我使用的是 Windows 64 位,而 Office 2010(32 位)找不到可安装的 ISAM。

4

1 回答 1

1

您需要验证是否安装了正确的 DLL。IE Msexcl40.dll

请参阅(忽略它说访问 2k 并按照解决步骤) http://support.microsoft.com/kb/209805

于 2013-04-19T17:50:52.200 回答