Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Error on Duplicate Key Update! (Urgent)
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00111425
Message ID:
00111474
Vues:
17
>How to handle this error??
>
>Even I have an error handler, to clear this error....
>it still got problem and crash my system.... ~>_<~
>
>I got this error when TableUpdate(.T.) that user has key-in dup. key!
>Code of Update will be:
>
>if TableUpdate(.t.) == .f.
>  messageb('TableUpdate error!!',48,'Fail to Update')
>  TableRevert(.t.)
>endif
>
Hi,

You can use AERROR() function to determine last error occured.

Amend your code just like this

IF TABLEUPDATE(.T.) = .F.
LOCAL ARRAY laerr[1]
AERROR(laerr)
MESSAGEBOX(laerr[1],48,'Fail to Update')
TABLEREVERT(.T.)
ENDIF

You may want to give user chance to amend the key-value. in such a case
remove TABLEREVERT(.T.) and let the user save the data again after changing
key-values.


Bye
Jayesh
- Jayesh
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform