Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Error on Duplicate Key Update! (Urgent)
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00111425
Message ID:
00111474
Views:
16
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform