Winform程序App.Config里.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="Connect_String" value="user id=***;data source=***;password=***"/>
</appSettings>
</configuration>
读取的时候:
string connectionString = System.Configuration.ConfigurationSettings.AppSettings.Item("Connect_String")
----------------------------------------------------------------------------------------------------------
web.config里面
<appSettings>
<add key="ConnString" value="Server=(local);database=test;uid=sa;pwd=123456"/>
</appSettings>
其他页面调用
string strconn = System.Configuration.ConfigurationManager.AppSettings["ConnString"];