Occurs just before closing a connection.
property BeforeDisconnect: TNotifyEvent;
Write a BeforeDisconnect event handler to take application-specific actions just before the connection component closes a database connection.
When the Disconnect method is called or the Disconnect property is set to False, a BeforeDisconnect event is generated, the connection is closed, and then an AfterDisconnect event is generated. In the BeforeDisconnect event handler, the Connected property value is still True.