I may have been unclear. The code I've shown is not causing a problem. I think it works. I'm asking if it COULD cause a problem that I haven't anticipated. It seems like a good thing to include in an error handler or a cleanup procedure, but I don't remember seeing it. I don't like to assume that I figured out anything new.
The idea of it came from code I was writing that looks like this:
BEGIN TRANSACTION
*** some code that changes data and might cause an error
END TRANSACTION
I may have had other problems with my error handler as well.
>Hi Bret,
>I ran into this problem with a DO WHILE loop and had to take the Rollback out. It seemed to me that your BEGIN TRANS and ROLLBACK commands have to be at the same 'nesting' level. Have you tried a for/next loop? Does it give you the same problem?
>
>And if not you may have to use an IF/Endif construction to check. Luckily you can only have 6 levels.
>
>HTH
>Barbara
>
>>I put this code in my error handler and also in my cleanup code:
>>
>>DO WHILE TXNLEVEL() > 0
>> ROLLBACK
>>ENDDO
>>
>>
>>It seems like a good idea to me. I had been getting errors following other errors that said "command cannot be used within a transaction" or something. Can anyone see a problem with what I have? There's a lot I don't know about proper error handling.