1.配置文件部分节点
<connectionStrings>
<add name="connstr" connectionString="dffsafds"/>
</connectionStrings>
获取string s = ConfigurationManager.ConnectionStrings["connstr"].ToString();
2.配置文件部分节点
<appSettings>
<add key="conn" value="~/App_Data/test.mdf"/>
<add key="db" value="Access"/>
</appSettings>
获取:string s= ConfigurationManager.AppSettings["conn"].ToString();