I have an object based on CSLA that when bound to the WinGrid will run a SQL command to save the data when you change the cell value and move to another row (apply the edit). If an error occurs in the SQL satetement, how can I trap the error (catch an exception) being thrown? I tried Grid's Error event but that didn't help.
If the grid's data source raises an error, then this will trigger either the Error or CellDataError event of the grid. If neither of those events is firing, then the error must be occurring either before or after the grid has already completed the update.
Keep in mind that the grid only updates the local data source. The grid has no interaction with the back end. So maybe the CSLA object is updating the back end asynchronously after the grid has already finished the update to the local data source objects.
I did some more digging and the error occurs when a grid calls EndEdit() on the business object. That in turn triggers Save operation which runs a SQL statement where the exception is thrown.
So the exception is occurring when the grid calls EndEdit, but the grid is not catching that Exception and firing Error or CellDataError? The only way that could happen is if the Exception is occurring asynchonrously (after the grid has completed the transaction).
Can you post the call stack of the exception?