编纂
会员
- 已加入
- 2020年12月4日
- 留言内容
- 18
- 编程经验
- 1-3
这是我的网络表单的更新按钮代码。它给这个错误在"comm.ExecuteNonQuery();"。但是,具有插入操作的button1对此没有显示任何错误。
button2:
protected void Button2_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("Data Source=DESKTOP-A85V0ME\\SQLEXPRESS;Initial Catalog=CRUDWEBFORM;Integrated Security=True");
con.Open();
SqlCommand comm = new SqlCommand("Update 进入 StudentInfo_Tab set StudentName = '" + TextBox2.Text + "',Address = '" + DropDownList1.SelectedValue + "',Age ='" + double.Parse(TextBox3.Text) + "',Contact = '" + TextBox4.Text + "'where StudentID = '" + int.Parse(TextBox1.Text)+ "'", con);
comm.ExecuteNonQuery();
con.Close();
ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "alert('Succesfully Updated');", true);
LoadRecord();
}