将数据库连接保存在xml文件中是否很好 [英] Is it good to save database connections in xml file

查看:106
本文介绍了将数据库连接保存在xml文件中是否很好的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通常会在客户端计算机上部署vb.net数据库应用程序.

I am on a general scenario of deploying my vb.net database application on my client's computer.

考虑到将来更改数据库连接设置的问题,我计划将其存储在app目录中的普通xml文件中,以便将其安装在任何位置,以便进行数据库配置,我只需要进行更改即可该文件,我的程序运行平稳.

Thinking of future problem of changing the database connection setting, i am planning to store it in a normal xml file in the app directory so that where ever it is installed, in order to make database configuration i only need to make change to that file and my program runs smoothly.

那么将数据库连接设置存储到应用程序目录中的xml配置文件的想法还是还有其他更好的想法?

So is this idea of storing database connection setting to xml config file in app directory or is there any other better idea?

我正在计划将其用于vb.net winforms应用程序

I am planning it for vb.net winforms applications

推荐答案

如果您使用的是2.0或更高版本,则可以使用一个单独的文件来存储常规设置,并将它们与主.config文件中的内容分开,例如:

If you're using 2.0 or later, you can use a separate file to store general settings and separate them from what's on the main .config file, like:

<appSettings file="myotherfile.config" />

然后可以仅更新一个文件.

You can then update just that one file.

有关更多信息,请参见信息.

See this for more information.

请注意,在ASP.NET中,对于web.config文件,对appSettings文件的更改不会触发整个web.config的重新加载.

Note that under ASP.NET, for web.config files, a change to the appSettings file does not trigger a reload of the whole web.config.

这篇关于将数据库连接保存在xml文件中是否很好的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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