Event handling
<< Click to Display Table of Contents >> Event handling |
![]() ![]() ![]() |
ADO support events for the Connection and Recordset objects. Xs2Ado has also support for these events build in.
To work with Events you need to take the following steps:
•Create a subclass of AdoConnectionEvents or AdoRecordSetEvents
•Implement the methods that you are interested in
•Do not implement any of the other methods
•Call the EnableEvents method of the AdoConnection or AdoRecordset object
•Pass an instance of your Event handler class to this method
The methods of these two classes all receive a lStatus parameter which indicates the current status of the Connection/Recordset. This lStatus parameter is also used to tell ADO if it needs to continue to call your event handler.
If you are not interested anymore in a particular event, you need to set the lStatus parameter to AdStatusUnwantedEvent and this particular event will not be called anymore for the object which is being monitored.
If you are done monitoring a Connection or RecordSet object you should call the DisableEvents method of this object.
AdoConnection, AdoConnectionEvents, AdoCOnnection:EnableEvents(), AdoCOnnection:DisableEvents(), AdoRecordSet, AdoRecordSetEvents, AdoRecordSet:EnableEvents(), AdoRecordSet:DisableEvents(), AdoEnableConnectionEvents(), AdoEnableRecordSetEvents()