using System.Data.SqlClient;
protected void btndata_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("DATA SOURCE=WAVE\\SQLEXPRESS;Integrated Security=ture;INITIAL CATALOG=DB_SM;");
con.Open();
if (con.State = ConnectionState.Open)
{
Response.Write("数据库已打开");
}
con.Close();
}
}
用了一个button控件,出现了一个错误:上下文不存在ConnectionState.求解决