读取 excel 文件:来自 c# 的连接错误?

Reading an excel file : connection error from c#?

我的程序需要读取 Excel 文件中的一些数据。

我的配置:

Windows10 x64/Visual Studio2019/Office 2019 x64

我在使用这段代码时遇到了一些问题:

string connectionString1 = @"Provider=Microsoft.ACE.OLEDB.15.0;Data Source=" + filePath22 + ";Extended Properties=\"Excel 12.0 Xml;HDR=YES;IMEX=1\";";

连接字符串似乎不正确,我收到一条错误消息:

"The 'Microsoft.ACE.OLEDB.15.0' provider is not registered on the local machine."

我已经尝试安装 "Microsoft Access database engine 2010 x64" 和 "Microsoft Access database engine 2016 x64" 但问题仍然存在...

感谢您的帮助! ;)

我发现这个论坛 post 建议安装 Microsoft access 2013 运行时。

论坛 link:https://answers.microsoft.com/en-us/msoffice/forum/all/the-microsoftaceoledb150-provider-is-not/6430a47d-263c-43af-aabc-f134da4b830e

运行时 link:https://microsoft.com/en-us/download/details.aspx?id=39358