Disconnected recordset

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Tom Nys (tom.nys_at_agfa.com)
Date: 03/16/04


Date: 16 Mar 2004 07:19:07 -0800

Hi,

I am using disconnected recordsets, though I notice that a serverside
cursor is used whenever retrieving recordsets through the second
connection in case I have 2 connections to SQLServer. Sample code:

_CommandPtr command;
command.CreateInstance(__uuidof(Command));
_bstr_t sqlbstr ("SELECT * FROM TABLE");
command -> PutCommandText(sqlbstr);
command -> PutActiveConnection( _variant_t((IDispatch *) connection2
));
result->CursorLocation = adUseClient;
_variant_t conn;
conn.vt = VT_ERROR;
conn.scode = DISP_E_PARAMNOTFOUND;
result->Open((_variant_t((IDispatch*)command)), conn, adOpenStatic,
adLockReadOnly, -1);
conn.vt = VT_UNKNOWN;
conn.punkVal = NULL;
result->PutActiveConnection(conn);
command->PutActiveConnection(conn);

I use MSDASQL as provider.

Anyone ever noticed this issue?

When retrieving data over the first connection, the disconnected
recordset seems to work fine. I noticed the issue by looking with SQL
Profiler.

Thanks for any tips!

Tom.



Relevant Pages

  • Re: VB-ADO-SQL Server : SQL Server performs logins after some queries
    ... It should not open new connection, ... > All recordsets in all procedure refer to this specific DB connection ... > Meanwhile I've found the origin of all my SQL Server errors that I faced: ... > not used to open one or more connection objects for different recordsets ...
    (microsoft.public.vb.database.ado)
  • Re: VB6 ADO DB2 - Update Problem
    ... Jeweils ein Feld der beiden ... Was veranlasst Dich zu der Annahme, dass Daten eines Recordsets mit ... Man kann eine Connection auch ohne ein solches Ungetüm öffnen, ... Warum serverseitiger Cursor? ...
    (microsoft.public.de.vb.datenbank)
  • Re: ADODB
    ... In general, use datasets (the .NET equivalent of recordsets), and bind ... I make a connection to a SQL2005 database when my app loads using the ... LogonUsers = 0 ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Timeout
    ... Dim Rst as ADODB.Recordset ... rst.Open sql, cn, adOpenKeyset, adLockReadOnly <- hier kommt der timeout ... Eigenschaften Deines Recordsets schon vor dem .Open mit den richtigen Werten ... Set .Active Connection = Cnn ...
    (microsoft.public.de.vb.datenbank)
  • Re: ADP Reports cancell with no error because sql server takes to
    ... It turns out the connection ... timeout value was blank and i set that to zero. ... creating your own recordsets as the sources of your reports. ...
    (microsoft.public.access.reports)