Update Database From DevExpress GridControl

Posted On // Leave a Comment
After spend hours in google, finaly I got answer about how to update database when my GridControl is updated or inserted a new row. the code is really simple, but not as simple as find the right keyword to google it ;).

So here's the few code


Private Sub __UpdateMasterJasa(ByVal grid As DevExpress.XtraGrid.GridControl)

        Try
            'save the latest changes
            Dim view As ColumnView = grid.FocusedView
            If Not (view.PostEditor() And view.UpdateCurrentRow) Then Return

            'Update the database's Jasa table to which SQLDataAdapter DAMstJasa is connected
            DAMstJasa.Update(DS.Tables("MstJasa"))

        Catch ex As Exception

            MsgBox(ex.Message)

        End Try

    End Sub

Enjoy ;)

0 komentar: