存储数据库连接字符串? [英] storing database connection string ?

查看:82
本文介绍了存储数据库连接字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您能否告诉我,我可以在哪里存储数据库连接字符串,以便可以读取它,并且在通过更改连接字符串而无需编译项目的情况下部署项目后,我必须获取新的连接字符串,就像我在web.config文件中一样.

will you please tell me that where can i store the database connection string so that i can read it and after deploying the project by changing the connection string and without compiling the project i have to get the new connection string, Like i am doing in web.config file.

推荐答案

您可以通过在项目中添加一个XML文件来实现此目的.当应用程序加载该XML文件中的读取连接字符串时.您可以在安装时将这种默认XML文件放入AppData文件夹中.您可以手动更改,也可以给 用户使用同一WPF应用程序更改其运行时的选项.

You achieve this by adding one XML file to your project.When application loads read connection string from this XML file. You can put this kind of default XML file in the AppData folder while installation. You can change it manually as well as you can give option to user to change it runtime using same WPF application.

此致


这篇关于存储数据库连接字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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