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

  

posted @ 2016-01-24 22:24  Akgu  阅读(348)  评论(0编辑  收藏  举报