0
cmd.CommandText = "UPDATE tbl_System SET S_Name='" & TextBox2.Text & "', S_Function='" & RichTextBox1.Text & "', S_Failure='" & RichTextBox2.Text & "' WHERE EquipTag='" & Tbl_SystemDataGridView.CurrentRow.Cells(0).Value & "'

i think this is correct format for update query but i still get error for this

3
Contributors
3
Replies
15
Views
1 Year
Discussion Span
Last Post by sing1006
0

I presume the error you got was regarding incorrect SQL syntax. You didn't post the error message. Without seeing the actual query, determining the problem will be, well, a problem. The actual query passed to the database engine depends on

  1. the constant strings like "UPDATE tbl_System" etc
  2. the strings you are patching in like TextBox2.Text

After the statement you posted, add

Debug.WriteLine(cmd.CommendText)

and post the output here.

0

thanks for the reply, i manage to solve it. The problem is i forgot to " in the end of my query

        cmd.CommandText = "UPDATE tbl_System SET S_Name='" & TextBox2.Text & "', S_Function='" & RichTextBox1.Text & "', S_Failure='" & RichTextBox2.Text & "' WHERE EquipTag='" & Tbl_SystemDataGridView.CurrentRow.Cells(0).Value & "'"

Edited by sing1006

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.