Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Handling errors inside a transaction
Message
From
26/06/2001 09:32:55
Walter Meester
HoogkarspelNetherlands
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00523402
Message ID:
00523532
Views:
17
Hi Alonso,

>I was thinking about something that i could tell the user exactlly what happened. Something like "Duplicated PK" (this i check before BEGIN TRANS), etc.
>
>So, i would issue a ROLLBACK knowing why i had to.

You could also use
nError=0
ON ERROR nError=ERROR()

IF nError = 0
   END TRANSACTION
ELSE
   ROLLBACK
ENDIF

DO CASE 
   CASE nError=0
        ... Transaction succesfull

   CASE nError=1
        .... Handle the error

   CASE nError=2
        .... Handle the error

   ...
ENDCASE
You can also use TABLEUPDATE( 2, lForce, Alias, cErrorArray) to check if a transaction is succesfull without using the error routine.

AERROR() is another function that you might find to be helpfull to determine the cause of the error.

Walter,
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform