Subject Re: [IBO] Handling a FK violation in OnError
Author Antti Kurenniemi
Geoff,

thank you. I will check the code you pointed to (dang, I suck at reading
other people's code ;-), and yes, I do use the update bar and I use it a
lot. I'm wondering if I'm doing something out of the ordinary here / should
I be doing this in a different way? I pretty much only need to change the
error message to something more end-user friendly in some cases, such as the
FK violation on delete...


Antti Kurenniemi

----- Original Message -----
From: "Geoff Worboys" <geoff@...>
To: <IBObjects@yahoogroups.com>
Sent: Friday, September 22, 2006 2:15 AM
Subject: Re: [IBO] Handling a FK violation in OnError


> Hi Antti,
>
>> 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.
>
> A quick glance at the code... the issue is that once you
> 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