How to restore connection?

I have tried the Session.CheckConnection of D433 and it worked just fine with
something like this:

procedure TForm1.AHMTimer321Timer(Sender: TObject);
begin
if First = true then // avoid startup
if MySession.CheckConnection(true) ccOK then // still with us?
begin
Banner1.Enabled := true;
Banner1.Visible := true; // scroll text show server down
Down := true; // status indicating server down
end
else
begin // OK
Banner1.Enabled := false;
Banner1.Visible := false;
if Down then // we have been down and are now OK
begin // if so reopen queries
Eier.Active := false;
Eier.Active := true;
Down := false;
end;
end;

One weakness is using a timer -
I there another solution than using a timer?
 
A solution without using timers could be to call CheckConnection before each call of Execute. If the result is not OK then call something like this:

Code:
REPEAT
  ... // Trigger some Banners or ...
  Sleep (<some ms> );
UNTIL (CheckConnection (TRUE) <> ccError) OR Application.Terminated;

------------------
Oliver Kaesmann
 
Back
Top