如何在运行时在窗口应用程序c#dotnet中更改app.config中的连接字符串 [英] how to change connection string in app.config at runtime in window application c# dotnet

查看:77
本文介绍了如何在运行时在窗口应用程序c#dotnet中更改app.config中的连接字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我搜索谷歌,但所有代码都不适合我..

请帮助我



i使用sql 2008r2进行小型应用程序我做了设置,但问题是如何在运行时更改连接字符串。

i search google but all the code not working for me ..
please help me

i make small application with sql 2008r2 and i make setup that but problem is how change connection string at a runtime.

推荐答案

你见过这篇文章



希望它有所帮助。
Have you seen this article?

Hope it helps.


你需要有不同的连接字符串和相应的键..然后在代码中你需要根据动态条件使用它。
you need to have different connection string with respective keys.. Then in code you need to use it as per the dynamic conditions.


这篇关于如何在运行时在窗口应用程序c#dotnet中更改app.config中的连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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