<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="Connectionstr" value="server=主机名字;database=数据库名字;uid=sa;pwd="/>
</appSettings>
<system.web>
使用:
using System.Configuration; //引用
string strConn=ConfigurationSettings.AppSettings["Connectionstr"];
SqlConnection objConn=new SqlConnection(strConn);