Subject Re: [IBO] Re: How to reconnect to database
Author Andreas Bednarek
Hello Gerhard, thanks for reply, but I believe that's not it :-(

RaiseException := False; avoids raising exception after exiting the OnError
handler, but doesn't surpress the dialog that appears when calling
Disconnect inside the handler which says 'Dataset is currently fetching'. I
tried that right now to prove it.

Any other suggestions?
thanks
Andreas


P.S. my whole code looks like this if somebody wants to have a look:


procedure TFormData.DatabaseFPNetError(Sender: TObject;
const ERRCODE: Integer; ErrorMessage, ErrorCodes: TStringList;
const SQLCODE: Integer; SQLMessage, SQL: TStringList;
var RaiseException: Boolean);

const
boFlag : Boolean = False;

begin

RaiseException := True; //probably default
if boFlag then exit;

boFlag := True;

if ERRCODE = 335544721 then //connection might be lost
try
DatabaseFPNet.Disconnect; //here it says 'Dataset is currently
fetching'
DatabaseFPNet.Connect;
RaiseException := False;
except
end;

boFlag := False;

end;



----- Original Message -----
From: "gbehnke2000" <Behnke@...>
To: <IBObjects@yahoogroups.com>
Sent: Thursday, January 15, 2004 3:55 PM
Subject: [IBO] Re: How to reconnect to database


> Hallo Andreas,
>
> in your event handler set
>
> RaiseException = false
>
> Then the the dialog dos'nt appear.
>
> I found the mentionend value (335544721) also per experiments.
>
> Regards
>
> Gerhard
>
> -- In IBObjects@yahoogroups.com, "Andreas Bednarek" <bluehorse@d...>
> wrote:
> > Hello everyone!
> >
> > Isn't there really anybody, who knows the solution? This must be a
> common
> > problem. I also searched the archive but was not succesfull, so
> I'll try it
> > once again, maybe I'm just missing something simple, but don't know
> what...
> >
> > Please how can I reconnect to DB (FB1.5 RC7) when the connection
> has been
> > lost? For example if the cable is disconnected and the connected
> again.
> > Beacuse the TIBODatabase.Connected property remains True (why?!?),
> the only
> > way is probably to listen to the exception (I use the IBO Data
> Access
> > components to connect do DB)
> >
> > I implemented an TIBODatabase.OnError event handler, where it looks
> roughly
> > like this:
> >
> > if ERRCODE = 335544721 then begin
> > Disconnect;
> > Connect;
> > end;
> >
> >
> > This works pretty well EXCEPT that calling Disconnect displays an
> > message box 'Dataset is currently fetching' and you have to
> > click 'OK' !!! For me It is necessary to avoid that dialog.
> >
> > I'm also not sure about the value 335544721 which has been
> discovered
> > empiricaly.
> >
> >
> > Do you know how to correctly reconnect to a (remote) FB database
> using
> > TIBODatabase?
> >
> > thank you very much
> > Andreas
>
>
>
___________________________________________________________________________
> IB Objects - direct, complete, custom connectivity to Firebird or
InterBase
> without the need for BDE, ODBC or any other layer.
>
___________________________________________________________________________
> http://www.ibobjects.com - your IBO community resource for Tech Info
papers,
> keyword-searchable FAQ, community code contributions and more !
>
>
> Yahoo! Groups Links
>
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/IBObjects/
>
> To unsubscribe from this group, send an email to:
> IBObjects-unsubscribe@yahoogroups.com
>
> Your use of Yahoo! Groups is subject to:
> http://docs.yahoo.com/info/terms/
>
>