22-05-17, 12:40 PM
كود :
For Each row As DataGridViewRow In dgv1.Rows
Dim cmd3 As SqlCommand = con.CreateCommand
cmd3.CommandText = "Insert Into bodycome([fatoranumber],totalfatora,snfnumber,snf,type,kmya,totalsnf) " & _
"values ('" & t2.Text & "',@tfatora,@snfnumber,@snf,@type,@kmya,@totalsnf)"
con.Open()
cmd3.Parameters.AddWithValue("@snfnumber", row.Cells(0).Value)
cmd3.Parameters.AddWithValue("@snf", row.Cells(1).Value)
cmd3.Parameters.AddWithValue("@type", row.Cells(2).Value)
cmd3.Parameters.AddWithValue("@kmya", row.Cells(4).Value)
cmd3.Parameters.AddWithValue("@tfatora", row.Cells(6).Value)
cmd3.Parameters.AddWithValue("@totalsnf", row.Cells(7).Value)
cmd3.ExecuteNonQuery()
cmd3.Dispose()
con.Close()
Next