Excel VBA 使用 ADODB 在 Sharepoint 上查询 MS Access 数据库 - “不是有效的文件名" [英] Excel VBA to query MS Access database on Sharepoint with ADODB - "Not a valid file name"
问题描述
有人可以启发我为什么在尝试连接到存储在 Sharepoint 上的 MS Access 数据库时收到无效的文件名"错误?我在连接到 C:\
any chance someone could enlighten me on why I'm getting an "Not a valid file name" error when trying to connect to MS Access database stored on Sharepoint? I have no issues with connecting to file on C:\
Set cnn = New ADODB.Connection
MyConn = "C:\somelocation\database.accdb"
With cnn
.Provider = "Microsoft.ACE.OLEDB.12.0"
.Open MyConn
End With
但是当我将 MyConn
更改为 Sharepoint 地址时,它不起作用:/
but when I change MyConn
to Sharepoint address it doesn't work :/
MyConn = "https://some.website.com/somelocation/database.accdb"
我收到无效的文件名".非常感谢您的帮助!
I'm getting a "Not a valid file name". I'd greatly appreciate your help!
推荐答案
下面使用连接字符串,而文件路径应该是这种格式
use connection string below, while the file path should be in this format
\YourSiteDomain\DavWWWRoot\YourFilePath\YourDBase.accdb(在资源管理器视图中打开您的SharePoint站点,右键单击数据库文件选择属性,然后您可以看到文件路径)
\YourSiteDomain\DavWWWRoot\YourFilePath\YourDBase.accdb (open you SharePoint site in Explorer view, right click the database file select properties, then you can see the file path)
连接字符串:Provider=Microsoft.ACE.OLEDB.12.0;Data Source=YourFilePath;Jet OLEDB:Database
connection string: Provider=Microsoft.ACE.OLEDB.12.0;Data Source=YourFilePath;Jet OLEDB:Database
这篇关于Excel VBA 使用 ADODB 在 Sharepoint 上查询 MS Access 数据库 - “不是有效的文件名"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!