There is a minor difference between VB6 DataEnvironment classes and migrated VB6DataEnvironment .NET classes. The original VB6 DataEnvironment class opens all its ADODB connection as soon as it is instantiated; the migrated VB6DataEnvironment class opens the connection only when a command is actually executed.
In the majority cases, this difference doesn’t cause any problem and slightly improve overall performance. However, you must keep this detail into accout if you want to share the DataEnvironment’s connection with other ADODB object or you want to manually execute one of the DataEnvironment’s commands. Consider the following code:
Dim adoCmd As ADODB.Command
Set adoCmd = deCRM.Commands("cmdCustomers")
The above code works fine under VB6, because the Command object extracted from the DataEnvironment is associated with an open connection, but fails when the code is migrated to .NET, because no open connection has been associated yet with the Command object. You can account for this difference by opening the connection and associating it to the Command yourself, as shown in this piece of VB.NET code:
Dim adoCmd As ADODB.Command = deCRM.Commands("cmdCustomers")
adoCmd.ActiveConnection = deCRM_DefInstance.datNwind