<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="ManagerName" value="XXX" />
</appSettings>
<connectionStrings>
<add name="DataBase" connectionString="Data Source=127.0.0.1;User ID=sa;Password=sa;Initial Catalog=test; " providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>
string aa=ConfigurationManager.ConnectionStrings[“DataBase”].ConnectionString;//添加system.configuration引用
string bb=ConfigurationSettings.AppSettings[key].ToString();