3/2/11

Save Data Grid Data

If DataGridView1.Rows.Count > 0 Then Dim r As DataGridViewRow For Each r In DataGridView1.Rows Dim db As New DBAccess Dim strSQL As String strSQL = "INSERT INTO [dbo].[Table_2] ([name1] ,[id1]) VALUES ( '" & r.Cells(0).Value & "'," & r.Cells(3).Value & " )" db.ExecuteScalar(strSQL, Data.CommandType.Text) db.CloseDB() Next End If