OnPost Error trap for Violation of Unique Key Constraint

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
vdruett
Posts: 1
Joined: Tue 10 Jan 2006 07:16

OnPost Error trap for Violation of Unique Key Constraint

Post by vdruett » Tue 10 Jan 2006 07:28

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

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Tue 10 Jan 2006 12:32

Try to write in MSQuery.PostError event handler something like this:

Code: Select all

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

Post Reply