RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TConnectionBroker.BeforeDisconnect Event

Occurs immediately before the connection closes.

Pascal
property BeforeDisconnect: TNotifyEvent;
C++
__property TNotifyEvent BeforeDisconnect;

Write a BeforeDisconnect event handler to take application-specific actions before dropping a connection.  

Delphi Examples: 

 

{
This BeforeDisconnect event handler makes sure that the
client dataset has applied all its pending updates before
terminating the connection to the server.
}
procedure TForm1.RemoteServer1BeforeDisconnect(Sender: TObject);
begin
  if (ClientDataSet1.ChangeCount > 0) then 
    ClientDataSet1.ApplyUpdates(-1);
end;

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!