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.

No terminating semicolon?

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 & "'"
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.