Пожалуйста, помогите в изменении кода
This code reduces the quantities of a particular item when it is sold, but I adjusted the schedule to have validity dates and I want it to reduce the quantities according to the oldest date and then delete it if the quantity is equal to zero and then reduce the latest date
Что я уже пробовал:
For Each r As DataGridViewRow In dgvprodac.Rows Dim ad As Integer = Val(r.Cells(0).Value) Dim txP As String = Val(r.Cells(1).Value) Dim xt As Single = Val(r.Cells(2).Value) Dim txC As Integer = Val(r.Cells(3).Value) cmd.CommandText = String.Format(" UPDATE [store] SET [sanf_kem] = sanf_kem -{0} WHERE [ID_sanf] = {1} and [date_ex] as MinDate ", xt, ad) cmd.ExecuteNonQuery() Next