如何在线获取 MS-Access DB 并使用 oledb 将其连接到 C#

How to get MS-Access DB online and connect it to C# using oledb

我在 Visual Studio 2012 年使用 accdb 数据库创建了一个项目并将它们连接起来,而 accdb 文件在我的计算机上。现在我希望该程序能够从任何计算机读取和编辑数据库,因此我将 accdb 文件上传到 ftp 服务器,但是当我尝试将其连接到项目时,出现错误。 当我的项目在 ftp 服务器上时,如何将它连接到 accdb?

I want that the program will be able to read and edit the database from any computer, so I upload the accdb file to ftp server, but when I try to connect it to project, I got an error. How can I connect my project to accdb when it is on ftp server?

您无法使用 FTP(或 SFTP 或 HTTP)协议连接 到 .accdb 数据库文件。连接到 .accdb 文件的唯一方法是通过 Windows 网络(使用 SMB 协议)。也就是说,应用程序必须可以使用正常的 Windows 文件路径访问 .accdb 文件,例如

G:\folder\subfolder\example.accdb

\servername\sharename\folder\subfolder\example.accdb

如果您想通过 Internet 执行此操作,则需要与 .accdb 文件所在的服务器建立某种 VPN 连接。 Windows Internet 上的文件共享将无法工作,因为端口经常被路由器和防火墙阻止(出于性能原因,您可能不想这样做)。

当然,您的应用程序可以使用 FTP 协议从服务器 下载 .accdb 文件,修改它,然后 上传 修改后的副本,但我怀疑这不是你想要的。