Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement