Re: why pRecordset->put_ActiveConnection(vtMissing) does not work?

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Jerry Pisk (jerryiii_at_hotmail.com)
Date: 08/05/04

  • Next message: prakashs_at_zylog.co.in: "CaseInSensitive"
    Date: Wed, 4 Aug 2004 19:53:03 -0700
    
    

    Did you read the manual? This is what the Close method documentation says:

    Connection

    Using the Close method to close a Connection object also closes any active
    Recordset objects associated with the connection. A Command object
    associated with the Connection object you are closing will persist, but it
    will no longer be associated with a Connection object; that is, its
    ActiveConnection property will be set to Nothing. Also, the Command object's
    Parameters collection will be cleared of any provider-defined parameters.

    You can later call the Open method to re-establish the connection to the
    same, or another, data source. While the Connection object is closed,
    calling any methods that require an open connection to the data source
    generates an error.

    Closing a Connection object while there are open Recordset objects on the
    connection rolls back any pending changes in all of the Recordset objects.
    Explicitly closing a Connection object (calling the Close method) while a
    transaction is in progress generates an error. If a Connection object falls
    out of scope while a transaction is in progress, ADO automatically rolls
    back the transaction.
    ---------------------------------------------

    What you need is something called disconnected recordset, there's a way to
    do that:

    http://support.microsoft.com/default.aspx?scid=kb;EN-US;184397

    You need to set the connection to NULL (either as VT_DISPATCH or
    VT_UNKNOWN), not to vtMissing, which I believe is VT_MISSING.

    Jerry

    "صوأ»¾¢" <seabelial@163.com> wrote in message
    news:u2sb6MgeEHA.3124@TK2MSFTNGP09.phx.gbl...
    > pRecordset->put_ActiveConnection(vtMissing)
    > I use this method to change ActiveConnetion Object;
    >
    > and then I use pRecordset->get_ActiveConnection(&varA) to get
    > current ConnectionObject, but nothing changed!
    >
    > why?
    >
    > I want to return a Recordset from a COM, if close the _ConnectionPtr,
    > then Recordset will be close, Why? How do?
    >
    >


  • Next message: prakashs_at_zylog.co.in: "CaseInSensitive"

    Relevant Pages

    • Re: ODBC/OLE DB Connection Pool
      ... > connection be kept open for the application as this will serialize all ... threads ONCE they are returned to the pool. ... > Tips for ADO Users ... > The ADO Connection object implicitly uses IDataInitialize. ...
      (microsoft.public.data.ado)
    • Re: ODBC/OLE DB Connection Pool
      ... > connection be kept open for the application as this will serialize all ... threads ONCE they are returned to the pool. ... > Tips for ADO Users ... > The ADO Connection object implicitly uses IDataInitialize. ...
      (microsoft.public.inetserver.asp.db)
    • Re: ODBC/OLE DB Connection Pool
      ... > connection be kept open for the application as this will serialize all ... threads ONCE they are returned to the pool. ... > Tips for ADO Users ... > The ADO Connection object implicitly uses IDataInitialize. ...
      (microsoft.public.data.oledb)
    • Re: Garbage Collection and Visual Studio
      ... Don't create the connection object on ... dispose of it. ... >> then use the Dispose method of that class. ... > the same connection object until the form is unloaded. ...
      (microsoft.public.dotnet.languages.csharp)
    • Re: not in list problem
      ... > make it work was with the connection object. ... >> are using one global connection while Access is using a different one may ... >>>> connection string to open a recordset, ...
      (microsoft.public.access.formscoding)