Subject | Re: [IBO] Handling a FK violation in OnError |
---|---|
Author | Dany M |
Post date | 2006-09-22T09:14:28Z |
Antti Kurenniemi wrote:
want to stop IBO from further processing just do an Abort! Abort is VCL
for throwing a silent exception (reservation for faulty semantics here).
In stead of
TIB_Query(Sender).Cancel;
do
RaiseException := false;
Abort;
IBO will not raise and exception (that will be of EIB_ISCError type and
thus making noise) rather you yourself raise an excption of EAbort type
and VCL will handle that silently (I hope).
BTW, I don't know *exactly* what the method Cancel does. I never had to
use it.
HTH,
/Dany
> Helen,I think Helen gave you the answer earlier but in convoluted text. If you
>
> thanks, but it doesn't work, I still get the error message about the FK
> violation. If I set the RaiseException to False, then I get the "Record was
> not located for delete" error. Here's my code exactly:
>
> procedure TCustomerForm.CustomersQueryError(Sender: TObject;
> const ERRCODE: Integer; ErrorMessage, ErrorCodes: TStringList;
> const SQLCODE: Integer; SQLMessage, SQL: TStringList;
> var RaiseException: Boolean);
> begin
> if ERRCODE = isc_foreign_key then
> begin
> ShowMessage(rsForeignKeyViolation); // the error message
> TIB_Query(Sender).Cancel;
> // RaiseException := False; // If this is uncommented, "Record was not
> located to delete"
> end;
> end;
>
want to stop IBO from further processing just do an Abort! Abort is VCL
for throwing a silent exception (reservation for faulty semantics here).
In stead of
TIB_Query(Sender).Cancel;
do
RaiseException := false;
Abort;
IBO will not raise and exception (that will be of EIB_ISCError type and
thus making noise) rather you yourself raise an excption of EAbort type
and VCL will handle that silently (I hope).
BTW, I don't know *exactly* what the method Cancel does. I never had to
use it.
HTH,
/Dany