今天通过一天的听讲,和下午的做做业,以竟本懂了用户控件
比如:再网页中调控件的值
TextBox a1 = this.h1.FindControl("TextBox1") as TextBox;
TextBox a2 = this.h1.FindControl("TextBox2") as TextBox;
string str = ConfigurationManager.ConnectionStrings["treecnn"].ConnectionString;
using (SqlConnection cnn = new SqlConnection(str))
{
SqlCommand cmm = cnn.CreateCommand();
cmm.CommandText = "insert into z1 (zh,mm) values('" + a1.Text + "','" + a2.Text + "')";
cnn.Open();
cmm.ExecuteNonQuery();
cnn.Close();
}