Re: why pRecordset->put_ActiveConnection(vtMissing) does not work?
From: Jerry Pisk (jerryiii_at_hotmail.com)
Date: 08/05/04
- Previous message: Sam Kong: "Access DB Cache?"
- Messages sorted by: [ date ] [ thread ]
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?
>
>
- Previous message: Sam Kong: "Access DB Cache?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|