日期:2014-05-18  浏览次数:20711 次

他竟然说我语法错误,哪错了?
今早用asp.net 和c#写一个信息更新操作 ,报错,说我update语法错误大家看看是哪错了,我没找到 
comm1.CommandText = "update [t2] set name='" + TextBox1.Text + "',sex='" + TextBox2.Text + "', address='" + TextBox3.Text + "', postcode='" + TextBox4.Text + "',idnumber='" + TextBox5.Text + "',bedroom='" + TextBox6.Text + "',time='" + TextBox7.Text + "',class='" + TextBox8.Text + "',major='" + TextBox9.Text + "'where id=" + Session["id"].ToString(); 

 

------解决方案--------------------
"update [t2] set name='" + TextBox1.Text + "',sex='" + TextBox2.Text + "', address='" + TextBox3.Text + "', postcode='" + TextBox4.Text + "',idnumber='" + TextBox5.Text + "',bedroom='" + TextBox6.Text + "',time='" + TextBox7.Text + "',class='" + TextBox8.Text + "',major='" + TextBox9.Text + "'where id=" + Session["id"].ToString();

监控string是什么,放到查询分析器中看看。大不了一行一行隔开。