Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Handling errors inside a transaction
Message
De
26/06/2001 09:32:55
Walter Meester
HoogkarspelPays-Bas
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00523402
Message ID:
00523532
Vues:
18
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,
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform