Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Finding duplicate keys
Message
De
14/01/1999 13:03:27
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00176022
Message ID:
00176076
Vues:
33
Hi Michelle.

>I guess I'm not clear on error trapping. Do I do something like this:
>
>ON ERROR llNotSaved = .T.
>TABLEUPDATE()
>IF llNotSaved
>*Error message
>ON ERROR

You don't need to set ON ERROR, because TABLEUPDATE() will return .F. and you can use AERROR() to get an array of error information.

For example:

if tableupdate()
* everything is OK
else
aerror(laError)
if laError[1] = 1884
* duplicate key value
endif
endif

Rather than doing the error handling directly here (after all, there are a number of reasons why TABLEUPDATE may fail), you might want to put the code in a different method. eg:

if tableupdate()
* everything is OK
else
This.HandleError()
endif

and have HandleError do the job (likely using a CASE statement for different errors).

Doug
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform