我似乎无法使用下面的连接字符串来读取.xlsx文件:VB.NET阅读XLSX文件给出了不是有效的路径
Webconfig
<add name="Excel07ConString" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties='Excel 8.0;HDR={1}'"/>
代码文件
conStr = ConfigurationManager.ConnectionStrings("Excel07ConString").ConnectionString
Dim connExcel As New OleDbConnection(conStr)
connExcel.Open()
我得到这个错误:
Cannot initialize the data source object of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)". OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" returned message "'F:\Ishan\Projects\ImportExcel2DB\ImportExcel2DB\Files\Whole Extract.xlsx' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.".
并且是在此特定位置存在文件。任何帮助,将不胜感激!
我的项目在你的连接字符串'{0}'和'{1}'。你传递给这些人的价值是什么? –