急!!!请大家帮我看一下代码,哪错了~这是点击一个添加按钮的代码
protected void Button2_Click(object sender, EventArgs e){
string name = this.T168.Value;
string a = this.D82.Value;
string b = this.T169.Value;
string c = this.T170.Value;
string d = this.T171.Value;
string ee = this.D83.Value;
string f = this.D84.Value;
string g = this.D85.Value;
string h = this.D86.Value;
string danwei = this.T172.Value;
SqlConnection con = new SqlConnection("server=localhost;database=xitong;uid=sa;pwd=123");
con.Open();
string str = "insert into canjiazhe (name,a,b,c,d,ee,f,g,h,danwei)values('" + name + "','" + xingbie + "','" + nian + "','" + yue + "','" + ri + "','" + zhiwu + "','" + zhuanc + "','" + xueli + "','" + xuewei + "','" + danwei + "')";
SqlCommand comm = new SqlCommand(str, con);
int ret = comm.ExecuteNonQuery();
con.Close();
if (ret > 0)
{
Response.Write("<script language='javascript'>alert('添加成功!');</script>");
Response.Write("<script>history.go(-1);</script>");
}
else { con.Close(); }
} --------------------编程问答-------------------- 什么问题?说清楚 --------------------编程问答-------------------- 这样很容易sql注入 --------------------编程问答-------------------- 不要用history.go(-1);这种,应该用location.Href='前一页面.aspx' --------------------编程问答-------------------- 说报什么错?
这很难看出来
补充:.NET技术 , ASP.NET