如何使用编码在App.config中添加/更改连接字符串 [英] How to Add/Change Connection String in App.config with Coding

查看:59
本文介绍了如何使用编码在App.config中添加/更改连接字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows窗体上有两个文本框
1.连接字符串名称
2.连接字符串

我想存储连接字符串名称(constr1)
connectionSring(数据源=.\ SQLEXPRESS;初始目录= abc;集成安全性= True;" providerName ="System.Data.SqlClient" )

App.config

提前thx

I have two textbox on windows form
1.connection string name
2.connection string

I want to store the conection string name(constr1) and
connectionSring("Data Source=.\SQLEXPRESS; Initial Catalog = abc; Integrated Security = True;" providerName="System.Data.SqlClient")

in App.config

thx in advance

推荐答案

看这里:
视频:动态更改SQLDataSource ...的连接字符串... [以编程方式设置connectionString属性 [如何轻松更改ConnectionString [
Look here:
Video: Change the connection string dynamically for SQLDataSource...[^]
Programmatically setting a connectionString property[^]
How to change ConnectionString easily[^]


请阅读在下面,
在c#winform数据库应用程序中使用app.config文件 [ ^ ]
了解节处理程序-App.config文件 [ http://msdn.microsoft.com/en-us/library/1xtk877y.aspx [ ^ ]

希望对您有所帮助:)
Please read below,
using app.config file in c# winform database application[^]
Understanding Section Handlers - App.config File[^]
and
http://msdn.microsoft.com/en-us/library/1xtk877y.aspx[^]

Hope it helps :)


这篇关于如何使用编码在App.config中添加/更改连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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