Subject Re: [IBO] Disconnect Troubles
Author Jason Wharton
This looks to me like you could be asking for an infinit loop.

It generally isn't a good idea to perform actually connect and disconnect
operations in an error handler. it is better to set some flags and then have
the operations be performed in some independent fashion.

For example, you would flash a message to the user that the connection has
been lost and what they should do. Then, after the exception is handled they
would go and do whatever it was they needed to.

HTH,
Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com


----- Original Message -----
From: "Paul Irwin" <paul@...>
To: <IBObjects@yahoogroups.com>
Sent: Monday, June 11, 2001 11:34 AM
Subject: [IBO] Disconnect Troubles


> I'm trying to handle the situation where I loose a connection to the
> database. In the OnError event of the TIB_Connection I have the following
> code:
>
> if (ERRCODE == 335544721 && IB_Con->ConnectionStatus !=
csDisconnectPending)
> {
> IB_Con->Disconnect();
> IB_Con->Connect();
> }
>
> I realize there needs to be more code to handle if it cannot connect
> again... but this is just some test code. The problem is that Disconnect
> generates another error and the connectionstatus gets reset to connected.
>
> How or what is the best way to handle this. I want to prompt the user
with
> a message that the connection has been lost and allow them to attempt to
> reconnect.
>
> Thanks,
>
> Paul
>
>
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>