Article ID: 147199
Article Last Modified on 7/1/2004
SELECT 0
*-- In Visual FoxPro 3.0:
*-- USE SYS(2004)+"samples\mainsamp\DATA\customer"
*-- In Visual FoxPro 5.0:
*-- USE SYS(2004)+"samples\tastrade\data\customer"
*-- In Visual FoxPro 6.0:
USE home(2) + "\tastrade\data\customer"
SET MULTILOCK ON
=cursorsetprop('Buffering', 5) && Optimistic Table buffering
LOCATE FOR customer_id="ANTON"
DELETE && this will fail because there are child records
LUPDATE=TABLEUPDATE(.T.)
IF LUPDATE=.F.
=TABLEREVERT()
=MESSAGEBOX('did not update')
=AERROR(aErrorArray)
DO CASE
CASE aErrorArray(1,5)=1
cMessage="Insert"
CASE aErrorArray(1,5)=2
cMessage="Update"
CASE aErrorArray(1,5)=3
cMessage="Delete"
ENDCASE
? cMessage
?? " "
?? aErrorArray(1,2)
ENDIF
USE
If you need more precise information than AERROR() provides and you have
used the RI builder to build the insert, update, or delete rules, you can
inspect the values that are stored in the gaError array. This array is
built by the RI builder. When an error occurs, the array is populated with
information about the error and about the tables and record for which the
trigger failed.
142284 How to Use gaErrors() to Find Out Why a Trigger Failed
Keywords: kbhowto kbdatabase KB147199