Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Finding duplicate keys
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00176022
Message ID:
00176081
Views:
24
>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

I think I'd rather write it as:
lnError = 0
lcOldError = ON("ERROR")
ON ERROR lnError = ERROR()
TABLEUPDATE()
IF lnError != 0
    DO CASE
        CASE lnError = ...
            WAIT WINDOW "Duplicate value found"
        CASE lnError = ...
            WAIT WINDOW "Could not update record"
        OTHERWISE
            WAIT WINDOW "Unexpected error of type " + ALLTRIM(STR(lnError)) + " detected"
    ENDcase
ENDif
ON ERROR &lcOldError
My blog
My consulting page
My home page

Member of the Trim Your Auto-Quote Campaign!
What's another word for thesaurus?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform