How can I force an RDO and ADO connection to share the same ODBC connection handle?
Posted on 2001-07-11
I am working on a database program that utilizes over a hundred forms, many of which contain RDO Data Controls. We would like to be able to migrate the RDO code to ADO code, particularly since Visual Basic.Net is going to have reduced RDO functionality, and the next Visual Basic release may not even support RDO anymore. However, the process of converting the code and data controls is going to be extremely time consuming.
The problem is that even though ADO and RDO are both going through ODBC (the ADO provider is MSDASQL, at least until we can phase out RDO completely), they cannot share the same ODBC connection handle. This means that we either have to upgrade the entire program all at once (which means that we cannot issue program updates until we remove all of the RDO connection objects and data control objects), or we need to double the number of connection handles going to the server (not an acceptable solution, since we do not want to increase our site license).
I have come up with a temporary solution: in the ADO WillConnect event I can close the user's RDO connection and refresh the ADO recordset, and in the RDO BeforeConnect event I can close the user's ADO connection and refresh the RDO resultset. This would allow us to continue to issue program updates between the time that we begin the RDO->ADO migration and the time that the migration is completed. However, this is not an ideal solution, since it will slow down the program considerably (even using ODBC connection pooling or saving recordsets), and it will also prevent the user from manipulating data on two different forms at once if those forms happen to use different connections.
Is there some way to create a single ODBC connection handle and force my RDO and ADO connections to share that handle between them?