问题描述
我有一个安装在小型办公环境中的桌面Windows应用程序.
I have a desktop Windows application that is installed in small office environments.
应用程序使用.MDB
数据库文件作为其数据库,该文件存储在网络驱动器上.
The application uses an .MDB
database file as its database which is stored on a network drive.
配置文件使用字母驱动器指定服务器上.MDB
文件的路径:例如. f:\data\db.mdb
Configuration files specify the path of the .MDB
file on the server using a letter drive: eg. f:\data\db.mdb
应用程序启动时需要访问此数据库文件.启动应用程序时,如何确保网络驱动器已连接且可访问?
The application needs to access this database file when it starts. How can I ensure the network drive is connected and accessible when the application starts?
有时Windows不会重新连接网络驱动器,并且连接它们的唯一方法是在我的电脑"中双击它们,即使在映射驱动器时选中了登录时重新连接".
Sometimes Windows doesn't reconnect network drives and the only way to connect them is to double-click on them in My Computer, even when "Reconnect at logon" is ticked when mapping the drive.
一种解决方案是使用\\machine_name\share
代替驱动器号吗?
Would a solution be to use \\machine_name\share
instead of drive letters?
推荐答案
您问,解决方案是使用\ machine_name \ share代替驱动器号吗?"
You asked, "Would a solution be to use \machine_name\share instead of drive letters?"
我认为是的,可能是这样. UNC路径可避免2个问题:
I think, yes, it could be. A UNC path avoids 2 problems:
- 共享未连接到驱动器号
- 共享已连接,但映射到的驱动器号与您预期的不同
未知的是,您的应用程序中的任何内容是否会使MDB的UNC路径变得复杂,还是使交易陷入僵局.
The unknown is whether anything in your application makes a UNC path for the MDB either a complication or a flat out deal-breaker.
这篇关于如何确保为应用程序连接了网络驱动器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!