我有一个程序可以将 Excel 中的数据导入数据集。要连接到 Excel,我使用以下代码...
return new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" +
fileName + "; Jet OLEDB:Engine Type=5;"+ "Extended Properties=\"Excel 8.0;\"");
我刚买了一台装有 Excel 2010 的新计算机,现在连接尝试失败并抛出异常说The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine
这是因为新版本的 Excel 需要不同的连接字符串吗?有没有人遇到过这个?
编辑:实际上我只是在某处读到使用 System.Data.OleDbClient 类甚至不需要在计算机上安装 Excel。所以我的问题可能与 Excel 无关,而是与 Microsoft.Jet 工具有关。我的电脑运行的是 Windows7 64 位。不是应该已经安装了吗?