这个 .XLSX 连接字符串即使经过多次修改似乎也不起作用

This .XLSX connection string does not seem to work even with multiple modifications

我知道有一些关于 .xlsx 文件的 ACE OLEDB 连接字符串的资源。

这是我当前的连接字符串:

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

我试过了

@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + uploadFilePath + ";Extended Properties=\"Excel 8.0;HDR=YES;\"";

也尝试过

@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + uploadFilePath + ";Extended Properties="Excel 12.0 Xml;HDR=YES";

我在 connectionstrings.com 和 Whosebug

上尝试过几次

通常我的错误是

{"External table is not in the expected format."}   

{"Format of the initialization string does not conform to specification starting at index 118."}

我做错了什么?关于要使用的正确连接字符串有什么建议吗? .xls 文件工作正常

你好我的朋友请看一下我的连接字符串:

mainFolder 是文件夹示例的路径:C:\Users\username\Desktop\Main 组合框文本是 excel 文件示例的全名:SomeSample.xlsx

 using (OleDbConnection connection =
                         new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + mainFolder + "" + @"\" + comboBox2.Text + ";Extended Properties=\"Excel 12.0;HDR=YES;\""))