Hello,
i am unable to update the database after editing a GridCheckBoxColumn.
I am able to update all the other columns (GridTextColumn and GridNumericColumn).
I use NPGSQL to get the data from a database.
Dim connString As String
connString = "Host=192.168.1.3;Username=****;Password=****;Database=*****"
conn = New NpgsqlConnection(connString)
conn.Open()
Dim Sql = "SELECT * FROM ""anagrafica sedi legali"" ORDER BY ""nome/ragione sociale"""
data_adapter = New NpgsqlDataAdapter(Sql, conn)
dset.Reset()
data_adapter.Fill(dset)
bindsource.DataSource = dset.Tables(0)
SfDataGrid1.SelectionMode = Syncfusion.WinForms.DataGrid.Enums.GridSelectionMode.Single
SfDataGrid1.AllowSelectionOnMouseDown = True
SfDataGrid1.EditMode = Syncfusion.WinForms.DataGrid.Enums.EditMode.SingleClick
SfDataGrid1.AutoGenerateColumns = True
SfDataGrid1.AutoSizeColumnsMode = Enums.AutoSizeColumnsMode.AllCells
SfDataGrid1.DataSource = bindsource
Then I update the database by clicking a button.
Private Sub SalvaDatiToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SalvaDatiToolStripMenuItem.Click
On Error GoTo errore
conn.Open()
Dim scb = New NpgsqlCommandBuilder(data_adapter)
'data_adapter.Update(dset)
data_adapter.Update(bindsource.DataSource)
conn.Close()
MsgBox("dati correttamente salvati")
Exit Sub
errore:
conn.Close()
MsgBox("errore di salvataggio")
End Sub
This code works well with all column except the GridCheckBoxColumn
I am able to update them only if I edit other data in same row.