0

以下connectionStrings可能有什么问题

string constr = @"Provider=Microsoft.ACE.OLEDB.12.0;
Data Source=\\otherPCName\SmoeSharedFolder\test.mdb;";

或者

string constr = @"Provider=Microsoft.ACE.OLEDB.12.0;
Data Source=\\192.168.14\SmoeSharedFolder\test.mdb;";

当我访问该 PC otherCP上的数据库时,以下连接字符串没有问题

string constr = @"Provider=Microsoft.ACE.OLEDB.12.0;
Data Source=D:\SmoeSharedFolder\test.mdb;";

我也可以使用此路径从其他 PC 打开文本文件。这告诉路径应该是有效的

\\otherPCName\SmoeSharedFolder\hi.txt

我已经看到了网络的连接字符串,所以我认为它们应该可以工作,但是如何工作?

4

1 回答 1

1
string constr = @"Provider=Microsoft.ACE.OLEDB.12.0;
Data Source=\\otherPCName\SmoeSharedFolder\test.mdb;";

string constr = @"Provider=Microsoft.ACE.OLEDB.12.0;
Data Source=\\192.168.1.14\SmoeSharedFolder\test.mdb;";

这两个字符串对于从网络 PC 访问数据库都是有效的。如果您的数据库文件存在于您有权访问的文件夹中=> 存在于共享文件夹中。 仅当您也具有写入权限时,您才能写入(更新/插入) 。

我得到了错误specified file cannot be openedotherPCName因为我在使用和 IP方面都有问题192.168.14。(对于其他pcname,我使用的是sampc,但它是sam-pc)。

于 2012-11-19T16:58:41.450 回答