Passing ADODB.Connection to VB dll RRS feed

  • Question

  • User2098947605 posted

    I've got a legacy ASP application that needs to pass an ADODB.Connection object to a VB 6 dll.  I'd like to pass the object rather than a connection string because I've got to do a half dozen different things in the PageLoad() event and would rather pass around the open connection.

    The vB dll method is defined as so...

    Public Function DoSomething(Conn as Object) as boolean

       'code is here

    End Function

    And I'm calling it in ASP like so...

    1 dim Conn

    2 set MyDLL = server.createobject("MyDll.MyClass")

    3 Set Conn = server.createobject("ADODB.Connection")

    4 Conn.ConnectionString = "blah blah blah"

    5 Conn.open

    6 If Not MyDll.DoSomething(Conn) then

     7 Response.write "Error"

    8 End If

    I'm getting a type mismatch error in ASP on line "6".

    Any ideas anyone???

    Monday, March 28, 2005 7:04 PM

All replies

  • User-823196590 posted

    Try this:  DoSomething(Conn as Variant)

    IIRC, ASP only wants to pass around variant types.

    Wednesday, March 30, 2005 8:15 AM