Subject | Re: [IBO] Handling a FK violation in OnError |
---|---|
Author | Helen Borrie |
Post date | 2006-09-21T06:37:16Z |
At 03:47 PM 21/09/2006, you wrote:
isc_foreign_key:
begin
ShowMessage('Cannot delete Whatever because it contains Whatever');
Sender.Cancel;
end;
another_symbol: blah
...
else
RaiseException := true;
end;
case, it's entirely a matter between the application and the user -
it has nothing to do with the database. In the second, you're
intercepting a database error condition and handling it. Besides
that, isc_foreign_key is not the only possible exception condition
that will prevent the cancel from succeeding.
Helen
>Thank you, Helen. I have two additional questions: how exactly do I cancelcase ERRCODE of
>the delete in the OnError, to prevent the exception from being displayed?
isc_foreign_key:
begin
ShowMessage('Cannot delete Whatever because it contains Whatever');
Sender.Cancel;
end;
another_symbol: blah
...
else
RaiseException := true;
end;
>And, is there a way to "ask" the database via IBO (or any other way) if aNo, because they are two altogether different things. In the first
>record can be deleted? The way I do it now is first ask the user if they
>really want to delete the record, then attempt to delete it and then throw
>an error if the delete fails, which is sort of clumsy.
case, it's entirely a matter between the application and the user -
it has nothing to do with the database. In the second, you're
intercepting a database error condition and handling it. Besides
that, isc_foreign_key is not the only possible exception condition
that will prevent the cancel from succeeding.
Helen