We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Using 'both' Paging and Binding with VB.Net SfDataGrid not saving edits.


Thanks for looking in advance, I'm only a hobbyist so sorry for the code :-)
I'm trying to use both Paging and Binding with VB.Net SfDataGrid however my updates are not being saved back to the DB. I'm using the following code:

Imports System.Data.SQLite
Imports Syncfusion.WinForms.DataGrid.Enums

Module Mod_DataBindingDGV

    Public testTable As New DataTable
    Public bindingSource1 As New BindingSource
    Public adapter As New SQLiteDataAdapter
    Public builder As New SQLiteCommandBuilder(adapter)

    Public Sub GetDataGridView(ByVal sqlString As String)
        Dim sqlCommand As String = sqlString
        Dim SQLconnect As New SQLite.SQLiteConnection With {
    .ConnectionString = Mod_SQLConnections.CreateSQLiteConnectionString

        testTable = New DataTable

        adapter = New SQLiteDataAdapter(sqlCommand, SQLconnect)
        bindingSource1.DataSource = testTable


        Form1.SfDataPager1.DataSource = bindingSource1
        Form1.SfDataPager1.PageSize = 5
        Form1.SfDataGrid1.DataSource = Form1.SfDataPager1.PagedSource
        Form1.SfDataGrid1.AllowEditing = True
        Form1.SfDataGrid1.EditMode = EditMode.DoubleClick
    End Sub

On Form1

AddHandler SfDataGrid1.CurrentCellEndEdit, AddressOf sfDataGrid_CurrentCellEndEdit

    Private Sub sfDataGrid_CurrentCellEndEdit(ByVal sender As Object, ByVal e As CurrentCellEndEditEventArgs)
        MessageBox.Show("The editing is completed for the cell (" & e.DataRow.RowIndex & "," & e.DataColumn.ColumnIndex & ")")
    End Sub

The data is loaded as expected and pages correctly, also the edit completed MessageBox fires.

Thanks Andy

3 Replies

AK Adhikesevan Kothandaraman Syncfusion Team June 25, 2019 01:48 PM UTC

Hi Andy, 

Thanks for using Syncfusion products. 

By default, while editing the cell or row in the SfDataGrid will update the value only in the view. It will not updated to the underlying data source. If you want to update the source once the field is edited in the grid, you have to manually update the value by calling the update method. Please refer to the following code snippet, 

Code Snippet:  
 //To update the data in the DataSource  


AN andy June 26, 2019 02:24 AM UTC


I got this to work however I had to remove 'SfDataPager' element from the form completely otherwise the adapter.Update(testTable) has no changes. Also I rearranged the order to:


Not sure how I can use 'SfDataPager ' and still use adapter.Update(testTable).


AK Adhikesevan Kothandaraman Syncfusion Team June 26, 2019 01:01 PM UTC

Hi Andy, 
Regret for the inconvenience caused. 
By default, the SfDataPager does not support the DataTable as the DataSource. So that can you please try this with the IEnumerable collections. 
Please find the following UG link for the limitation.  

Live Chat Icon For mobile
Up arrow icon