Dim da2 As OleDb.OleDbDataAdapter
Dim cols As Integer = Attendance_QueryDataGridView.ColumnCount
Dim rows As Integer = Attendance_QueryDataGridView.Rows.Count
Dim a(cols) As String
Dim dt As New DataTable("Attendance")
da2 = New OleDb.OleDbDataAdapter(sql, con)
da2.Fill(ProjectDataSet, "Attendance")
Dim NewRow As DataRow
NewRow = ProjectDataSet.Tables("Attendance").NewRow
For z = 0 To cols - 1
a(z) = Attendance_QueryDataGridView.Columns(z).HeaderText
dt.Columns.Add(a(z))
Next
For x = 0 To rows - 2
NewRow("RainbowID") = Attendance_QueryDataGridView.Item(0, x).Value
For y = 3 To cols
For z = 3 To cols - 3
NewRow(a(z)) = Attendance_QueryDataGridView.Item(y, x).Value
Next
Next
Next
dt.NewRow()
da.Update(dt)
shrighead 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.