Problem sharing ADO connection between COM Objects (complex problem) 
Author Message
 Problem sharing ADO connection between COM Objects (complex problem)

Rene -
Here's what's happening, as I understand it.
1. You can't pass a connection object across process boundaries.
2. When your main app instantiates one of your objects (from a dll) it runs
in your main app's process, so you can hand it a connection object.
3. When you run your main app in the VB environment, and you call objects in
a compiled dll, the VB environment runs these objects in a separate process.
So you can no longer pass a connection object to them.
For debugging purposes, add the class modules from the dll to your main
app's project. Then they can all happily run in the same process.
HTH!
SR


Quote:
> Hello,

> I have one main applications that calls objects to procedure reports and
> other stuff.

> To these objects I pass the ADODB.Connection, so the object can use the
> connection from the main application (I don't want multiple connection).

> When an object is compiled it works, but when I start an object from VB to
> debug it, I get a runtime error 3001.
> I think the reason for this is when a compiled object is called, it uses
the
> instance of the ADO object from the application. When my object is started
> from VB, another instance of the ADO object is created by the VB
environment
> (because I added the ADO 2.5 to the reference list).

> So my conclusion: If I have two instances of ADO, I cannot pass the
> connection of the first instance to the second, and create a recordset in
> the second instance with the connection of the first object.

> Is this correct or is there a solution?

> Regards,

> Rene

> APP:
> set obj = CreateObject ( "MyObject.Class" )
> obj.Initialize gcn
> obj.RunReport

> OBJECT:
> obj.Initialize ( pcn as adodb.connection )
>   set rs = new adodb.recordset
>   rs.open <query>, pcn
>   ' pcn cannot be used here when object is started from VB
>  ' Run time error '3001' Arguments are of the wrong type etc.



Fri, 25 Apr 2003 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. VB6: Problem sharing ADO connection between COM Objects (complex problem)

2. Problem sharing ADO connection between COM Objects (complex problem)

3. VB6: Problem sharing ADO connection between COM Objects (complex problem)

4. Can I share connection in COM object?

5. Com 1 and Com 3 sharing IRQ problem

6. Sharing an ADO connection with an ActiveX out-process object

7. connection problem with ADO command object ......

8. problems using OpenSchema method of an ADO connection object

9. Please help!!!ADO connection object problem

10. ADO Connection Problem and Windows 2000 - multiuser problem

11. how do I declare an ADO connection for a COM object

12. Connection Problem - ado failover connection

 

 
Powered by phpBB® Forum Software