求助!向数据库添加数据
protected void Button1_Click(object sender, EventArgs e){
string CustomerName=this .TextBox1 .Text.ToString();
string Gender=this .TextBox2 .Text.ToString();
string Age=this .TextBox3 .Text.ToString();
string IDNumber=this .TextBox4 .Text.ToString();
string Career=this .TextBox5 .Text.ToString();
string Education=this .TextBox6 .Text.ToString();
string Phone=this .TextBox7 .Text.ToString();
string Address=this .TextBox8 .Text.ToString();
string Zip=this .TextBox9 .Text.ToString();
string Email=this .TextBox10 .Text.ToString();
string CCount = "1";
string BigCustomer;
添加一段程序,如果Career的内容为“商业”,Age的内容为“大于30小于50”,并且Education的内容为“高等”,则BigCustomer为“YES”,否则为“No”。
SqlConnection DBConnectionString = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["DBConnectionString"]);
DBConnectionString.Open();
SqlCommand scd = new SqlCommand("insert into Customer(CustomerName,Gender,Age,IDNumber,Career,Education,Phone,Address,Zip,Email,CCount,BigCustomer)values('" + CustomerName + "','" + Gender + "','" + Age + "','" + IDNumber + "','" + Career + "','" + Education + "','" + Phone + "','" + Address + "','" + Zip + "','" + Email + "','" + CCount + "','" + BigCustomer + "')", DBConnectionString);
scd.ExecuteNonQuery();
DBConnectionString.Close();Response.Write ("<script language=javascript>alert('您已经添加成功');location='Add_Customer.aspx'</script>");
}
其中,Career,Education,BigCustomer等都为数据库字段。请高手帮我编写一下所要添加的那段程序,谢谢!