OLEDb and Disxonnected Recordsets 
Author Message
 OLEDb and Disxonnected Recordsets

Hello,
i'm tryting to get a disconnected recordet. The connection object as and SQL
Server OLEDB connection string.
the connection is created with a adUseClient  Cursorlocation.

the recordset has the cursortype set to adOpenStatic.

the recordset is popluated by a command object,which calls a stored
procedure  (Command.execute)
when i try to disconnect the recordset
like
    set rsTemp.activeconnection = Nothing
i get the error saying
"
Cannot change the ActiveConnection property of a Recordset object which has
a Command object as its source
"
can anyone explain this ? and how to get around this problem

now this piece of code works fine with a sql server ODBC dsn.
i'm using sql server 2000, on win2k
all of these run in a webclass



Tue, 04 May 2004 20:37:51 GMT
 OLEDb and Disxonnected Recordsets

Hi,

Sorry I cann't explain why. Maby you should look for the cursorlocation
after the execute.
Ado is in charge and might change the settings at will.

The solution is not to call the execute on the command object, but to create
a new recordset and pass the command object to the "open" method of the
created recordset.
......
set cmdData = new adodb.Command
with cmdData
       .CommandType = ....
      ....
     Set .ActiveConnection = cnData 'cnData.Cursorlocation must be
clientside
end with

set rsData = new adodb.recordset
with rsData
  .open cmdData, , adOpenStatic, adLockOptimistic
  set .Activeconnection = nothing   'this will do the trick
end with

Good luck


Quote:
> Hello,
> i'm tryting to get a disconnected recordet. The connection object as and
SQL
> Server OLEDB connection string.
> the connection is created with a adUseClient  Cursorlocation.

> the recordset has the cursortype set to adOpenStatic.

> the recordset is popluated by a command object,which calls a stored
> procedure  (Command.execute)
> when i try to disconnect the recordset
> like
>     set rsTemp.activeconnection = Nothing
> i get the error saying
> "
> Cannot change the ActiveConnection property of a Recordset object which
has
> a Command object as its source
> "
> can anyone explain this ? and how to get around this problem

> now this piece of code works fine with a sql server ODBC dsn.
> i'm using sql server 2000, on win2k
> all of these run in a webclass



Tue, 04 May 2004 23:35:05 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. OLEDb and Disxonnected Recordsets

2. SQL SRVR 7 : DTS ADO recordsets w OLEDB connections

3. ADO - SqlServer - ODBC/OLEDB - Recordsets

4. SQL SRVR 7 ADO recordset cursors from OLEDB conn

5. ADO Recordset ODBC/OLEDB error

6. Problem with disconnected recordset, OLEDB, ADO

7. How to save OLEDB recordset in XML file

8. Query/Recordset problem on inner join with sql oledb provider

9. Persisted Recordset as OLEDB Source?

10. Passing parameters use JET OLEDB with Recordset.Open

11. OLEDB and disconnected recordsets

12. OLEDB RowSet to ADO Recordset conversion


 
Powered by phpBB® Forum Software