ADO for Windows Foundation Classes (ADO/WFC) builds on the ADO event model and presents a simplified application programming interface. In general, ADO/WFC intercepts ADO events, consolidates the event parameters into a single event class, and then calls your event handler.
To use ADO events in ADO/WFC
public void onConnectComplete(Object sender,ConnectionEvent e)
{
System.out.println("onConnectComplete:" + e);
}
ConnectionEventHandler handler =
new ConnectionEventHandler(this, "onConnectComplete");
The first argument of the ConnectionEventHandler constructor is a reference to the class that contains the event handler named in the second argument.
The Microsoft Visual J++ compiler also supports an equivalent syntax:
ConnectionEventHandler handler =
new ConnectionEventHandler(this.onConnectComplete);
The single argument is a reference to the desired class (that is, this) and method within the class (that is, onConnectComplete).
The ADO/WFC event handler passes ADO ConnectionEvent parameters in an instance of the ADO/WFC ConnectionEvent class, or ADO RecordsetEvent parameters in an instance of the ADO/WFC RecordsetEvent class. These ADO/WFC classes consolidate the ADO event parameters; that is, each ADO/WFC class contains one data member for each unique parameter in all the ADO ConnectionEvent or RecordsetEvent methods.
public void onConnectComplete(Object sender,ConnectionEvent e)
The first argument is the type of object that sent the event (Connection or Recordset), and the second argument is the ADO/WFC event object (ConnectionEvent or RecordsetEvent).
The signature of your event handler is simpler than an ADO event. However, you must still understand the ADO event model to know what parameters apply to an event and how to respond.