Active is a Boolean property that determines if database and dataset components associated with a session are open. You can use this property to read the current state of a session's database and dataset connections, or to change it. If Active is False (the default), all databases and datasets associated with the session are closed. If True, databases and datasets are open.
A session is activated when it is first created, and subsequently, whenever its Active property is changed to True from False (for example, when a database or dataset is associated with a session is opened and there are currently no other open databases or datasets). Setting Active to True triggers a session's OnStartup event, registers the paradox directory locations. with the BDE, and registers the ConfigMode property, which determines what BDE aliases are available within the session. You can write an OnStartup event handler to initialize the NetFileDir, PrivateDir, and ConfigMode properties before they are registered with the BDE, or to perform other specific session start-up activities.
Once a session is active, you can open its database connections by calling the OpenDatabase method.
For session components you place in a data module or form, setting Active to False when there are open databases or datasets closes them. At runtime, closing databases and datasets may trigger events associated with them.
Session1.Close;
Session1->Close();
This code sets Session1's Active property to False. When a session's Active property is False, any subsequent attempt by the application to open a database or dataset resets Active to True and calls the session's OnStartup event handler if it exists. You can also explicitly code session reactivation at runtime. The following code reactivates Session1:
Session1.Open;
Session1->Open();
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
|
What do you think about this topic? Send feedback!
|