protected void Button1_Click(object sender, EventArgs e) { Stutest modle = new Stutest(); modle.Chooseone = RadioButton1.Text; modle.Choosetwo = RadioButton4.Text; modle.Choosethree = RadioButton6.Text; modle.Choosefour = RadioButton8.Text; modle.Choosefive = RadioButton10.Text; modle.Textone = TextBox1.Text; modle.Texttwo = TextBox2.Text; modle.Textthree = TextBox3.Text; modle.Textfive = TextBox4.Text; modle.Textsix = TextBox5.Text; modle.Txteseven = TextBox7.Text; if (bll.Add(modle) > 0) { Response.Write("<script language='javascript'>alert('提交成功');</script>"); Button1.Enabled = false; Button1.Text = "已提交"; } else { Response.Write("<script language='javascript'>alert('添加成功');</script>"); } }
public int Add(Stutest modle) { string sql = "insert into Stutest(Chooseone,Choosetwo,Choosethree,Choosefour,Choosefive,Textone,Texttwo,Textthree,Textfive,Textsix,Txteseven)values(@Chooseone,@Choosetwo,@Choosethree,@Choosefour,@Choosefive,@Textone,@Texttwo,@Textthree,@Textfive,@Textsix,@Txteseven)"; SqlParameter[] para = { new SqlParameter("@Chooseone", modle.Chooseone), new SqlParameter("@Choosetwo", modle.Choosetwo), new SqlParameter("@Choosethree", modle.Choosethree), new SqlParameter("@Choosefour", modle.Choosefour), new SqlParameter("@Choosefive", modle.Choosefive), new SqlParameter("@Textone", modle.Textone), new SqlParameter("@Texttwo", modle.Texttwo), new SqlParameter("@Textthree", modle.Textthree), new SqlParameter("@Textfive", modle.Textfive), new SqlParameter("@Textsix", modle.Textsix), new SqlParameter("@Txteseven", modle.Txteseven) }; return(DBHelperSQL.Execute(sql, para)); }
public int Add(Stutest modle) { return(dal.Add(modle)); }