When you make any changes to the grid control, the changes are reflected in the datasource, that is in your case a DataTable. If you think logically, it seems correct as the Grid Control is bound to the DataTable and is not aware about how the DataTable gets populated.
Now you can see that the DataTable is populated using DataAdapter. You need to call the DataAdapter.Update(dataTable) method to push the changes to database.
The best approach is already suggested by @Aseem that you need to implement ADO.net binding to commit changes back to the back-end using the DataAdapter. If you can implement this way then check below tutorial:
When binding to a database using ADO.NET, you bind a control to a
DataTable containing data from the database. When you change data via
the Grid Control (adding, deleting or modifying records), the changes
are accumulated in the DataTable. They are not automatically posted to
the underlying database. Therefore, you need to manually call a
specific method to post the changes.
If you are using custom data table and not willing to implement such binging then you have to handle GridView.RowUpdated Event and then you can post back then changes that you made in current updated row.
Private Sub gridView1_RowUpdated(ByVal sender As System.Object, ByVal e As DevExpress.XtraGrid.Views.Base.RowObjectEventArgs) Handles gridView1.RowUpdated
Dim val As Object
Dim row As DataRowView = CType(e.Row, DataRowView)
val = row(0)
Hope this help..
Asked in February 2016Viewed 2,270 timesVoted 11Answered 2 times