PRB: rdoConnection_Connect Event Does Not Always Fire (191788)
The information in this article applies to:
- Microsoft Visual Basic Enterprise Edition for Windows 4.0
- Microsoft Visual Basic Enterprise Edition for Windows 5.0
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
This article was previously published under Q191788 SYMPTOMS When using the OpenConnection method of a rdoEnvironment
object to establish a connection to a local database, the Connect event of the
rdoConnection object will not fire.
The Connect event will fire,
however, when using the EstablishConnection method of the rdoConnection object.
CAUSE This is primarily caused by the speed of the connection.
When accessing a database server that resides locally, the connection is made
and the Connect event is fired before the object can be returned to your
program. Because the object has not yet been returned, custom event handlers
are not called.
Basically, when using the
rdoEnvironment.OpenConnection on a synchronous call, a connection is
established first and then the object is returned, whereas using
rdoConnection.EstablishConnection, an object has already been created before
the connection is established.
Specifying rdAsyncEnable (an
asynchronous connection) in the OpenConnection method will not solve the
problem on machines where the database server is local. Because the database
server is local, the connection is created before RDO has an object to return
to the calling program. When the database is remote, RDO has enough time to
return the rdoConnection object to the calling program before the connection is
established. When the connection is finally established, the Connect event will
fire normally.
NOTE: You must specify rdAsyncEnable to make
OpenConnection fire the Connect event or the Connect event will never fire
under any circumstances. If rdAsyncEnable is not specified, the connection is
always made to the database before the object is returned. RESOLUTION To work around this problem, try using the
EstablishConnection method of a valid connection object. Because the object has
already been created and your program has the event handler established before
the connect call has been made, the Connect event will always fire correctly.
STATUS Microsoft is researching this problem and will post new
information here in the Microsoft Knowledge Base as it becomes available.
Modification Type: | Minor | Last Reviewed: | 3/2/2005 |
---|
Keywords: | kbprb kbRDO KB191788 |
---|
|