Akram.19
on Jun 29, 2022 07:43 AM
397 Views
I have a table in sql that contains a varchar() column called Transaction_Value.
I have a Button in form1 that must update that column with specific word but there are no any updates in table.
Dim UpdateCmd1 As String = "UPDATE DATAGRID " & _
"SET Transaction_Type ='" & "Loading" & "' " & _
"WHERE tank_name ='" & ComboBox1.Text & "' AND material_name = '" & ComboBox2.Text & "'"
If SQL.Update(UpdateCmd1) = 0 Then
MsgBox("")
Exit Sub
End If
Download FREE API for Word, Excel and PDF in ASP.Net:
Download
Akram.19 says:
Dim
UpdateCmd1
As
String
=
"UPDATE DATAGRID "
& _
"SET Transaction_Type ='"
&
"Loading"
&
"' "
& _
"WHERE tank_name ='"
& ComboBox1.Text &
"' AND material_name = '"
& ComboBox2.Text &
"'"
In your update query you have specified Transaction_Type. You need to specify the Transaction_Value column with its value.
Use parameterized query instead of string concatenation.