OleDbException being thrown at adp.Fill saying “Co

2019-08-06 00:07发布

        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);

I am using Windows 64-bit and Office 2010 (32-bit) is Could not find installable ISAM.

标签: c# excel
1条回答
做个烂人
2楼-- · 2019-08-06 01:11

You need to verify the correct DLL is installed. IE Msexcl40.dll

see (ignore it says access 2k and follow the steps for resolving) http://support.microsoft.com/kb/209805

查看更多
登录 后发表回答