Click to See Complete Forum and Search --> : Problem passing a Connection between objects


January 31st, 2000, 11:55 AM
Hi All,
I'm trying to open an ADODB::Connection in a ActiveX object implemented in VB6 and pass a reference of that connection to another ActiveX object in al differente dll.
I don't know what's going wrong but I have an error when I try to set that connection as a recordset's activeConnection.
Does anyone have any clue about this problem?
Thanks in advance,
Julio

Reznor_X
January 31st, 2000, 02:46 PM
I've tryed the same thing, it seems that you can't pass open connections between exe->dll...
you need to open the connection from your dll instead.

February 2nd, 2000, 07:43 AM
That is not exactly the case. You can pass an open connection and use the execute method to create a recordset. The problem with this is that you cannot specify some recodset properties like lockType.

What I don't understand is why you can pass an adodb.connection between objects and use the execute method but you cannot set this connection as the recordset's activeConnection.

Sometimes this is a very importan feature, e.g., when you need to perform some queries within an open transaction.

Regards,
Julio.

Spectre
February 2nd, 2000, 08:37 AM
The previous post isn't exactly correct either. You cannot use the execute method of a connection or recordset from within a dll - use the recordset's open method to run your queries.

February 2nd, 2000, 04:08 PM
This is the scenario I've tried:
One application creates and open a ADODB.Connection. The same app creates an object implemented in a differente DLL and passes a connection's reference to the new object.
The results I've got are:
1.- I can call execute method and get a recordset (with the limitation I mentioned in a previous message)
2.- When I try to set that connection as the recordset's activeConnection (modifing that property or as the argument of the open method) I get an error.
If anyone has differente results, let me know them to investigate a little further.
Regards,
Julio.