CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Guest

    Problem passing a Connection between objects

    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


  2. #2
    Join Date
    Jan 2000
    Location
    MX
    Posts
    51

    Re: Problem passing a Connection between objects

    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.




  3. #3
    Guest

    Re: Problem passing a Connection between objects

    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.


  4. #4
    Join Date
    Feb 2000
    Posts
    137

    Re: Problem passing a Connection between objects

    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.


  5. #5
    Guest

    Re: Problem passing a Connection between objects

    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.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured