Before you quit from an error handler, you have to make sure that all pending transactions are rolled back and all dirty buffers are reverted.
Here is the code in my error handler to achieve that. I'd be grateful for feedback or corrections.
* Rollback any transactions in progress
DO WHILE TXNLEVEL() > 0
* Revert all pending updates in all data sessions
lnSessionCount = ASESSIONS(laSessions)
FOR lnI = 1 TO lnSessionCount
SET DATASESSION TO laSessions(lnI)
lnTableCount = AUSED(laTables)
FOR lnJ = 1 TO lnTableCount
IF CURSORGETPROP("Buffering", laTables(lnJ,1)) > 1
This should be executed before any message to the user is displayed (because you don't want the user to sit staring at the message while a transaction is in progress).
Transactions are scoped to a single Data Session. The TableRevert() will also undo any of the pending changes. You may not want this if the user could correct the error. Dan Goodwin
Category Error Handling Category Data
( Topic last updated: 2005.06.23 01:56:09 PM )