Dim intQty As Integer For Each row As DataGridViewRow In Me.DataGridView1.Rows Dim intProductID As Integer Dim strSQL As String If row.Cells(0).Value > 0 Then intProductID = row.Cells(0).Value intQty = row.Cells(3).Value strSQL = "UPDATE Items SET Quantity = Quantity - " & intQty & " WHERE Barcode = " & intProductID Dim cmd_a As OleDbCommand = New OleDbCommand(strSQL, cnn) cmd_a.ExecuteNonQuery() End If Next row
Barcode
(Quantity - " & intQty & ")
strSQL = "UPDATE Items SET Quantity = Quantity - @qty WHERE Barcode = @barcode;" cmd.Parameters.AddWithValue("@qty", intQty) cmd.Parameters.AddWithValue("@barcode", intProductID)
;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)