Web.config中常用语句的使用方法和调用方法:
最新推荐文章于 2022-04-29 20:35:40 发布
在web.config中:
<appSettings>
<add key="ConnectionString" value="server=.;database=message;uid=sa;pwd=;"></add>
</appSettings>
调用时:
using System.Data.SqlClient;
using System.Configuration;
SqlConnection conn = new SqlConnection();
conn.ConnectionString=ConfigurationSettings.AppSettings["ConnectionString"];