Page 1 of 1

OnPost Error trap for Violation of Unique Key Constraint

Posted: Tue 10 Jan 2006 07:28
by vdruett
Hi - I am trying to capture a Violation of Unique key constraint error. I am using delphi7, SDAC 2.45.1.20 02.07.03 and MS SQL2000. Could someone provide an example of how to trap this explicit error on the onpost event of a table
Cheers

Posted: Tue 10 Jan 2006 12:32
by Ikar
Try to write in MSQuery.PostError event handler something like this:

Code: Select all

if (E is EMSError) and (EMSError(E).ErrorCode = ...) then ...