General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
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
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only