如何定义我的MDB数据库存储在本地硬盘中的位置(VB.NET)

时间:2022-09-24 11:13:15

VB.net seem to place my database file into /userprofile/local settings/apps/2.0/data/random/random/appname/data/ folder.

VB.net似乎将我的数据库文件放入/ userprofile / local settings / apps / 2.0 / data / random / random / appname / data / folder。

Can I define easier location for my published app. I am also worried that when upgrading this database is ignored or something bad happens?

我可以为我发布的应用定义更简单的位置。我也担心升级这个数据库时会被忽略或发生什么不好的事情?

1 个解决方案

#1


Can I define easier location for my published app.

我可以为我发布的应用定义更简单的位置。

Well inside of your connection string you can specify the location of the database under Data Source.

在连接字符串内部,您可以在“数据源”下指定数据库的位置。

Take your database and move it where ever you want, and then update the Data Source inside of your connection string to point to that path. You might have to play with it a few times to get the path right, but this should do what you are wanting to do.

获取数据库并将其移动到任意位置,然后更新连接字符串内的数据源以指向该路径。您可能需要使用它几次以获得正确的路径,但这应该做您想要做的事情。

VB.net seem to place my database file into /userprofile/local settings/apps/2.0/data/random/random/appname/data/ folder.

VB.net似乎将我的数据库文件放入/ userprofile / local settings / apps / 2.0 / data / random / random / appname / data / folder。

If you are making an installer then you will want to keep the database close to the application, most likely inside a sub-folder in the application's directory (like the data folder). That is why VS (not VB .Net) tends to place a created database inside of the data folder.

如果您正在制作安装程序,那么您将希望将数据库保持在应用程序附近,很可能是在应用程序目录中的子文件夹(如数据文件夹)中。这就是为什么VS(不是VB .Net)倾向于将创建的数据库放在数据文件夹中。

#1


Can I define easier location for my published app.

我可以为我发布的应用定义更简单的位置。

Well inside of your connection string you can specify the location of the database under Data Source.

在连接字符串内部,您可以在“数据源”下指定数据库的位置。

Take your database and move it where ever you want, and then update the Data Source inside of your connection string to point to that path. You might have to play with it a few times to get the path right, but this should do what you are wanting to do.

获取数据库并将其移动到任意位置,然后更新连接字符串内的数据源以指向该路径。您可能需要使用它几次以获得正确的路径,但这应该做您想要做的事情。

VB.net seem to place my database file into /userprofile/local settings/apps/2.0/data/random/random/appname/data/ folder.

VB.net似乎将我的数据库文件放入/ userprofile / local settings / apps / 2.0 / data / random / random / appname / data / folder。

If you are making an installer then you will want to keep the database close to the application, most likely inside a sub-folder in the application's directory (like the data folder). That is why VS (not VB .Net) tends to place a created database inside of the data folder.

如果您正在制作安装程序,那么您将希望将数据库保持在应用程序附近,很可能是在应用程序目录中的子文件夹(如数据文件夹)中。这就是为什么VS(不是VB .Net)倾向于将创建的数据库放在数据文件夹中。