-1
I am trying to decrease the amount of stock at the time of sale and without success, I used the code below, no error appears..
Public Sub UpdateDecreaseQuantity()
Try
For Each row As DataGridViewRow In DataGridView1.Rows
Dim OtherValue As Integer = 0
Dim cb As String = "Update Dish SET Quantity = Quantity - @OtherValue"
con.Open()
cmd = New OleDbCommand(cb, con)
Integer.TryParse(row.Cells(2).Value, OtherValue)
cmd.Parameters.Add("@OtherValue", OleDbType.Integer).Value = OtherValue
cmd.ExecuteNonQuery()
con.Close()
Next
Catch ex As Exception
MsgBox(ex.Message)
Finally
cmd.Dispose()
con.Close()
End Try
End Sub
I see no problem, without more information we have no way to help.
– Maniero
No error, as the "Quantity" value in the Dish table is NOT decreased ( this is the problem)
– David Sanculane