app.config 配置的一种用法
app.config文件 <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> </configSections> <connectionStrings> <add name="LinqOperSQL.Properties.Settings.db_05ConnectionString" connectionString="Data Source=(local);Initial Catalog=db_05;User ID=sa" providerName="System.Data.SqlClient" /> </connectionStrings> <appSettings> <add key="strCon" value="Data Source=(local);Database=db_09;Uid=sa;Pwd=Zz208;"/> </appSettings> </configuration> 引用 string strCon = System.Configuration.ConfigurationManager.AppSettings["strCon"].ToString(); //引用要添加 system.configuration