Subject | Re: [IBO] Handling a FK violation in OnError |
---|---|
Author | Geoff Worboys |
Post date | 2006-09-21T23:15:06Z |
Hi Antti,
prevent the exception from being raised IBO continues with
its other processing - which includes checking how many rows
were effected by the call. Since the delete failed there were
0 rows deleted and so IBO reports that the record was not
available to delete (because that is what it looks like at
that point in the code).
One way around this one would be to place your exception
processing around your call to delete and deal with the problem
at that point. (If you are using TIB_UpdateBar then you may
have to replace it with your own buttons so you can capture the
delete call.)
Another possibility would be to use your existing error code to
change the error message - but still allow the exception to be
raised so that IBO will stop is standard processing and show
the reported error. Check out the code for the EIBO_ISCError
class and also for procedure TIBOInternalDataset.DoHandleError
in IBODataset.pas - to see how the various parts of the error
message are used by IBO's own error dialog.
--
Geoff Worboys
Telesis Computing
> thanks, but it doesn't work, I still get the error messageA quick glance at the code... the issue is that once you
> about the FK violation. If I set the RaiseException to False,
> then I get the "Record was not located for delete" error.
prevent the exception from being raised IBO continues with
its other processing - which includes checking how many rows
were effected by the call. Since the delete failed there were
0 rows deleted and so IBO reports that the record was not
available to delete (because that is what it looks like at
that point in the code).
One way around this one would be to place your exception
processing around your call to delete and deal with the problem
at that point. (If you are using TIB_UpdateBar then you may
have to replace it with your own buttons so you can capture the
delete call.)
Another possibility would be to use your existing error code to
change the error message - but still allow the exception to be
raised so that IBO will stop is standard processing and show
the reported error. Check out the code for the EIBO_ISCError
class and also for procedure TIBOInternalDataset.DoHandleError
in IBODataset.pas - to see how the various parts of the error
message are used by IBO's own error dialog.
--
Geoff Worboys
Telesis Computing