Help on database update

  • Thread starter Thread starter FST
  • Start date Start date
F

FST

Hello All,

Why does the database update from inside the Button1_Click event, but won't
update from inside the DataGrid1_CurrentCellChanged event when I change
cells? The message from inside the DataGrid1_CurrentCellChanged event
appears but OleDbDataAdapter1.Update(DataSet11) doesn't happen.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

OleDbDataAdapter1.Update(DataSet11)

MessageBox.Show("Database updated")

End Sub

Private Sub DataGrid1_CurrentCellChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles DataGrid1.CurrentCellChanged

MessageBox.Show("DataGrid1_CurrentCellChanged")

OleDbDataAdapter1.Update(DataSet11)

End Sub

Thanks,

Fred
 
Fred,

When the CurrentCellChanged event fires the rowstate may not have changed
yet. You might try ending the current edit before firing the update method.


Steve Stein
VB Team
This posting is provided "AS IS", with no warranties, and confers no
rights.



--------------------
 
Back
Top