Home - Forums-.NET - FlyGrid.Net (Windows Forms) - Bound datagrid doesnt update database

FlyGrid.Net (Windows Forms)

.NET Datagrid - Fast, highly customizable, industry standards .NET data grid control for WinForms

This forum related to following products: FlyGrid.Net

Bound datagrid doesnt update database
Link Posted: 16-Oct-2005 02:30
Hi,

I am currently assing the flygrid product, I think its good, but I have one problem, having copied the sample code into my application, and changed the relevent lines for my database, I canbt get the actual database to upate when I modify the cells.

I have added / modified the following code, but still no luck

On form

    Private MagicDatabase As NRays.Data.MagicCards_ADO


when connecting

            dataGrid.Rows.UpdateMode = UpdateMode.OnCellChangedOrLostFocus


    Private Function dataGrid_UpdateRowCellData(ByVal sender As Object, ByVal position As Integer, ByVal index As Integer) As Boolean Handles dataGrid.UpdateRowCellData

        MagicDatabase.AcceptChanges()
        Return True

    End Function


In Class

        Private _MagicDS As DataSet


        Public Sub AcceptChanges()

            _MagicDS.AcceptChanges()

        End Sub


Hopefully someone can help me

Thanks in advance
Link Posted: 17-Oct-2005 23:48
Probably your dataset has errors, try the following code (given from MSDN) to determine possible errors:
[VB.Net]
Private Sub CheckForErrors(myDataSet As DataSet)
    ' Invoke GetChanges on the DataSet to create a reduced set.
    Dim xDataSet As DataSet = myDataSet.GetChanges()
    ' Check each table's HasErrors property.
    Dim xTable As DataTable
    For Each xTable In xDataSet.Tables
        ' If HasErrors is true, reconcile errors.
        If xTable.HasErrors Then
            ' Insert code to reconcile errors.
        End If
    Next xTable
End Sub

Link Posted: 18-Oct-2005 00:48
Thanks,

The getChanges method returns Nothing when I call this routine in the dataGrid_UpdateRowCellData event

There must be something else that I need to do! I have also tried changing data in the example provided by you, and that doesnt work either

regards

George Forster
Link Posted: 27-Oct-2005 00:03
Does anybody have any sample code that shows how changing data on a bound grid updates the data in the database???


Regards
Link Posted: 03-Nov-2005 06:14
Hi, I have downloaded the latest version and your examples allow me to edit data in the grid, but these changes do not appear after disconnecting and re-connecting to the database.

What code should be added to make this work?

Thanks
Link Posted: 04-Nov-2005 05:33
It depends from how you initilize your database.
If you use OleDbDataAdapter you should define for this adapter.UpdateCommand and use adapter.Update method for updating database.
Link Posted: 10-Nov-2005 11:23
Thanks,

I understand now, and it works.