在web.config中<configuration>.......</configuration>之间加:
<appSettings>
<add key="MyCon" value="Server=172.16.3.60;Database=MyTest;uid=sa;pwd=zhangzs;Connect Timeout=30"/>
</appSettings>
在调用时,加引用 using System.Configuration;
之后
..............................
SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["MyCon"]);
//如果不使用webconfig中的连接串,上面这句更换为:
// SqlConnection myConnection = new SqlConnection("server=172.16.3.60;uid=sa;pwd=zhangzs;database=MyTest");
..............................
Access:
<add key="OleDbAccess" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source= 'E:\xxx\xxx.mdb' "/>
Oracle:
<add key="MyOracle" value="Data Source=L2DB;User id=tpco1;Password=tpco1"/>