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屋!