Hi,
I had this problem before, and I solved it with the following procedures:
=============================
Public Sub UpdateDatasource(ByVal OleDB As DataAdapter, ByVal grid As
GridControl, ByVal dataset11 As DataSet, ByVal TableName As String)
'Save the latest changes to the bound DataTable
Dim View As ColumnView = grid.KeyboardFocusView
View.CloseEditor() ' <=== VERY IMPORTANT Statement for any update
If Not View.UpdateCurrentRow() Then Return
'Update the database's table
DoUpdateTable(OleDB, dataset11.Tables(TableName))
'Update the database's table
End Sub
Public Sub DoUpdateTable(ByVal dataAdapter As DbDataAdapter, ByVal
dataTable As System.Data.DataTable)
dataAdapter.Update(dataTable)
End Sub
================================
I hope this helps you.
Regards
"Keith G" wrote:
Here is the code from the form which includes the Toolbar button events and
the unsuccessful 'EndEdit'.
Private Sub dsLoad()
Me.ObjDsSupplierList.Clear()
Me.OleDbDataAdapter1.Fill(ObjDsSupplierList.Tables (0))
End Sub
Private Sub ToolBar1_ButtonClick(ByVal sender As Object, ByVal e As
System.Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar1.ButtonClick
Dim dgtS As DataGridTableStyle = Me.dgdSuppliers.TableStyles(0)
'complete any edits
dgtS.DataGrid.EndEdit(dgtS.GridColumnStyles(Me.dgd Suppliers.CurrentCell.ColumnNumber), Me.dgdSuppliers.CurrentRowIndex, False)
Select Case ToolBar1.Buttons.IndexOf(e.Button)
Case 1
dsLoad()
Case 2
If ObjDsSupplierList.HasChanges() Then
Try
OleDbDataAdapter1.Update(ObjDsSupplierList)
Catch ex As Exception
MsgBox("There were errors in the data. The table has
not been updated." & vbCr & ex.Message)
End Try
End If
End Select
End Sub
"Charlie Brown" wrote:
Keith,
Can you post some of your code from the update event?