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

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.

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 1 Year Ago by sing1006

This question has already been answered. Start a new discussion instead.