ConnectionString 属性尚未初始化。
web.config<connectionStrings>
<add name="anh" connectionString="Data Source=ta;Initial Catalog=anh01;User ID=sa;Password=sa" providerName="System.Data.SqlClient"/>
</connectionStrings>
cs
protected void Page_Load(object sender, EventArgs e)
{
string anh =ConfigurationSettings.AppSettings["anh"];
SqlConnection conn = new SqlConnection(anh);
//conn.Open();
SqlDataAdapter da = new SqlDataAdapter("select name,qq from user", conn);
DataSet ds = new DataSet();
da.Fill(ds);
DataGrid1.DataSource = ds;
DataGrid1.DataBind();
ds.Dispose();
//conn.Close;
}