View Single Post
 
Old 07-31-2015, 04:52 AM
pjstreetglide pjstreetglide is offline
Newcomer
 
Join Date: Jul 2015
Posts: 1
Default Update database question

Hi all, I'm new to the forum. I'm just learning to do database programing and I'm having a problem with updating my table in my database. the changes work fine in the dataset but does not show up in the database. Here is my code...
Code:
        With ItemCheckGrid
            ColSel = .CurrentCell.ColumnIndex
            RowDex = .CurrentCell.RowIndex
            Select Case True
                Case rbOrdered.Checked
                    .Rows(RowDex).Cells(ColSel).Value = "O"
                Case rbSched.Checked
                    .Rows(RowDex).Cells(ColSel).Value = "Sch"
                Case rbIP.Checked
                    .Rows(RowDex).Cells(ColSel).Value = "IP"
                Case rbDNA.Checked
                    .Rows(RowDex).Cells(ColSel).Value = "NA"
                Case rbClear.Checked
                    .Rows(RowDex).Cells(ColSel).Value = ""
                Case rbComplete.Checked
                    .Rows(RowDex).Cells(ColSel).Value = "x"
            End Select

            Try
                Dim cb As New OleDb.OleDbCommandBuilder(da)
                If ds.Tables("Trackerds").Rows(RowDex).Item(2) = FixedGrid.Rows(RowDex).Cells(1).Value Then

                    ds.Tables("Trackerds").Rows(RowDex).Item(1) = FixedGrid.Rows(RowDex).Cells(0).Value
                    ds.Tables("Trackerds").Rows(RowDex).Item(2) = FixedGrid.Rows(RowDex).Cells(1).Value
                    ds.Tables("Trackerds").Rows(RowDex).Item(3) = FixedGrid.Rows(RowDex).Cells(2).Value
                    ds.Tables("Trackerds").Rows(RowDex).Item(ColSel + 1) = .Rows(RowDex).Cells(ColSel).Value

                    ds.AcceptChanges()
                    da.Update(ds, "Trackerds")
                    MsgBox(ds.Tables("Trackerds").Rows(RowDex).Item(ColSel + 1))
                    MsgBox("Entry Saved")
                End If
            Catch exceptionObject As Exception
                MessageBox.Show(exceptionObject.Message)
            Finally

            End Try

        End With
Reply With Quote