Sub modify_inventory(ByVal frm As frminventory)
Dim writesqltime As String
Dim writesqldate As String
Dim msg As String
writesqldate = Format(CDate(sqldate), "MM/dd/yyyy")
Dim cmd = New SqlClient.SqlCommand
If active_frm.Name <> "frminventory" Then
Exit Sub
Else
writesqldate = Format(CDate(sqldate), "MM/dd/yyyy")
Dim j As Integer
con = connect()
con.Open()
For j = 0 To 5
For i = 0 To frm.dgvitem(j).RowCount - 1
cmd = New SqlClient.SqlCommand("INSERT INTO minventory(groupcode,itemcode,itemqty,entrydate,locationcode,addt) VALUES('" & frm.dgvitem(j).Item(0, i).Value & "','" & frm.dgvitem(j).Item(1, i).Value & "'," & frm.dgvitem(j).Item(4, i).Value & ",'" & writesqldate & "'," & location_code & ",'" & writesqltime & "' )", con)
cmd.ExecuteNonQuery()
Next i
Next j
con.Close()
End If
End Sub
"array loop problem"
'my problem is when i am inserting data then 1st row is inserted correctly but the 2nd row is not taking the quantity(frm.dgvitem(j).Item(4, i).Value ) field right for inserting data i am using data grid