简单级别
web.config
</configSections>
<appSettings>
<add key ="connect" value ="server=.;database=FCMIS;uid=sa;pwd=111"/>
</appSettings >
<connectionStrings/>
调用web.config
//string str = "server=.;database=FCMIS;uid=sa;pwd=111";
string str = ConfigurationSettings.AppSettings["connect"];
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection(str );
conn.Open();
SqlCommand comm = new SqlCommand("table_ab",conn);
comm.CommandType = CommandType.StoredProcedure;
SqlDataAdapter sda = new SqlDataAdapter();
sda.SelectCommand = comm;
DataSet ds = new DataSet();
//DataTable dt = new DataTable();
sda.Fill(ds);
this.GridView1.DataSource =ds;
this.GridView1.DataBind();
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余4页未读,立即下载