Subject RE: [IBO] IBquery - OnError raises Exception, although RaiseException:=False
Author Jason Wharton
Try SysUtils.Abort.

Jason

> -----Original Message-----
> From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com]On
> Behalf Of G. Nau
> Sent: Monday, March 13, 2006 4:55 AM
> To: iBObjects@yahoogroups.com
> Subject: [IBO] IBquery - OnError raises Exception, although
> RaiseException:=False
>
>
> I'm checking for duplicate entries during the post within the
> query's onerror
> event:
> procedure TLager.IB_Query_BestellNrError(Sender: TObject;
> const ERRCODE: Integer; ErrorMessage, ErrorCodes: TStringList;
> const SQLCODE: Integer; SQLMessage, SQL: TStringList;
> var RaiseException: Boolean);
> begin
> inherited;
> if Pos('duplicate value',Errormessage.Text)>0 then
> Begin
> if Pos('IX_ZUSBESTELLNR',errormessage.text)>0 then
> Begin
> RaiseException:=False;
> DBGrid_BestellNr.SetFocus;
> BvOMessageBox('Die zusätzliche Bestell-Nr., die Sie
> eingegeben
> haben, gibt es bereits. Bitte prüfen und korrigieren Sie
> das.', 'Doppelte
> Zusatz-Bestell-Nr.', MB_OK);
> End;
> End;
> end;
>
> This is detecting the duplicate insertion and showing the
> messagebox. But
> after that I got an exception EIB_DatasetError (Record not inserted),
> although RaiseException is set to false.
>
> Did I make a mistake here or how can i prevent the exception
> message to
> the user?
>
> Regards
> Gunther