部署VB.Net Windows应用程序时如何获取数据库的位置? [英] How to get the location of database when we deploy a VB.Net windows application?

查看:42
本文介绍了部署VB.Net Windows应用程序时如何获取数据库的位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我在局域网服务器(共享位置)中有一个mdb文件。我必须在4个系统中部署我的VB.Net应用程序。



我在寻找的是什么,

当我在一个系统中部署我的应用程序时系统,应该询问DB位置提及。这样我就可以浏览共享位置的mdb文件了。我的应用程序将使用该DB进行插入/修改功能。

类似于剩余系统。因此局域网中的所有系统都将使用相同的数据库。



现在我的问题是,

部署应用程序时是否可行,我们可以让系统询问DB位置吗?

有没有其他方法可以实现相同的目的?

Hello everyone,
I have a mdb file in LAN server(Shared location). I have to deploy my VB.Net application in 4 systems.

What am looking for is,
When i deploying my application in a system, it should ask DB location to mention. So that i can browse to shared location mdb file. And my application will use that DB for insert/modify functions.
Similar for remaining systems. So that all systems in LAN will use the same DB.

Now my question is,
Is it possible when deploying an application, we can make system to ask for DB location?
Is there any other way to achieve the same?

推荐答案

是的,这是可能的。



您使用的是哪个数据库? mdb文件意味着你使用的是MS Access吗?





如果这样建立你的连接字符串使用密码使用以下



Yes it is possible.

By the which database are you using? mdb file means are you using MS Access?


If so build your connection string with password use following

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=DB_PATH;
Jet OLEDB:Database Password=MyDbPassword;





第一次运行应用程序时,要求用户提供mdb文件的网络路径,并在连接字符串中使用它代替DB_PATH并连接到数据库。



没有密码的连接字符串





While running application for the first time ask user to provide network path of the mdb file and use it in connection string in place of DB_PATH and connect to database.

Connection string without password

Provider=Microsoft.ACE.OLEDB.12.0;Data SourceDB_PATH;
Persist Security Info=False;


这篇关于部署VB.Net Windows应用程序时如何获取数据库的位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆