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。
答案 0 :(得分:1)
您需要验证是否安装了正确的DLL。 IE Msexcl40.dll
看(忽略它说访问2k并按照解决步骤) http://support.microsoft.com/kb/209805