When I try to update the amount of stock for the products in the table "product" from a DataGridView that contains the name of the products, it update only the first record it finds the DataGridView, others not
this is my code:
Dim a, b As Integer
Dim row As DataGridViewRow
For Each row In ConsultationDataGridView.Rows
If con.State = ConnectionState.Open Then con.Close()
con.Open()
Dim dr As OleDbDataReader
Dim cmd As New OleDbCommand("select * from t_produit where [Designation_recharge] = '" & ConsultationDataGridView.CurrentRow.Cells(1).Value & "'", con)
'On Error Resume Next
dr = cmd.ExecuteReader
If dr.Read = True Then
a = dr(4)
End If
b = (Val(a) - Val(ConsultationDataGridView.CurrentRow.Cells(2).Value))
Me.T_produitTableAdapter.modprod(b,ConsultationDataGridView.CurrentRow.Cells(1).Value)
Next
How can I update all the product at the same time
this is my code:
Dim a, b As Integer
Dim row As DataGridViewRow
For Each row In ConsultationDataGridView.Rows
If con.State = ConnectionState.Open Then con.Close()
con.Open()
Dim dr As OleDbDataReader
Dim cmd As New OleDbCommand("select * from t_produit where [Designation_recharge] = '" & ConsultationDataGridView.CurrentRow.Cells(1).Value & "'", con)
'On Error Resume Next
dr = cmd.ExecuteReader
If dr.Read = True Then
a = dr(4)
End If
b = (Val(a) - Val(ConsultationDataGridView.CurrentRow.Cells(2).Value))
Me.T_produitTableAdapter.modprod(b,ConsultationDataGridView.CurrentRow.Cells(1).Value)
Next
How can I update all the product at the same time