Hello: I have an unbound datagrid and I'm trying to save it's contents to my access database.
here's my code thus far:
Dim dt As New DataTable()
Dim dr As DataRow = Nothing
For j As Integer = 0 To (Me.DataGridView1.RowCount - 1) - 1
dr = dt.NewRow()
If j < 1 Then
For k As Integer = 0 To Me.DataGridView1.ColumnCount - 1
dt.Columns.Add()
Next
End If
For i As Integer = 0 To Me.DataGridView1.ColumnCount - 1
If Me.DataGridView1.Item(i, j).Value <> "" Then
'it wants to go through all the records...how can i look to see if the cell has been edited or not?
dr.Item(i) = Me.DataGridView1.Item(i, j).Value.ToString()
End If
Next
If j > 0 Then
dt.Rows.Add(dr)
End If
Next
How do I tell it to save to my database?
Any help is truly appreciated.
Thank you very much,
Proctor