我用ASP.NET(C#)请看代码,我修改数据,怎么修改不了?
protected void Button2_Click(object sender, EventArgs e)
{
string strConn = "server=(local);database=net;uid=sa;pwd=sa";
SqlConnection conn = new SqlConnection(strConn);
string name = TextBox1.Text.Trim(); //我获取值就不能更改数据库
string sec ="0000";//我自己赋值就可以更改数据库
string id = Request.QueryString["id"];
string sql = "update study_xuesheng set name='" + name + "',sec='" + sec + "' where id='" + id + "'";
SqlCommand comm = new SqlCommand(sql, conn);
conn.Open();
comm.ExecuteNonQuery();
conn.Close();
comm.Dispose();
}
我从页面获取过来的值怎么不能修改更新到数据库里面呢?也不提示错误?请高手帮帮吧,在线等候!!