🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #1336

Re: Assign to TADORecordSet

#1336
From: Viatcheslav V. Vassiliev
Date: Mon, 30 Aug 2004 06:14
97 lines
4264 bytes
Look TADOCustomDataSetOpenCursor() in ADODB.pas:

    while Recordset.State = adStateClosed do
    try
      FRecordsetObject := Recordset.NextRecordset(VarRecsAffected);
      if Recordset = nil then Abort;
    except
      DatabaseError(SNoResultSet, Self);
    end;

It is a code similar to one I proposed you and it seems that this solved
your problem.

//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)

"Paul Cheetham" <PAC.News@dsl.pipex.com> �������/�������� � ��������
���������: news:MPG.1b9c0bf1ca2a52b4989690@Newsgroups.Borland.com...
>
> Unfortunately that doesn't work.
> I got all sorts of compiler errors, and once I'd solved those I got run-
> time errors when trying to work with the recordset.
>
> I've managed to solve my problem by using a TADOStoredProc instead od a
> TADOCommand.
>
>
> Thanks for your help.
>
>
>
>
>
> In article <41301f8a$1@newsgroups.borland.com>, support@oledbdirect.com
> says...
> > Try do:
> >
> > rs = Command->Execute();
> > while (!rs->State = adStateOpen) rs = rs->NextRecordset(recAffected);
> > if (rs->State = adStateOpen) DataSet->Recordset = rs;
> > else ... //Recordset is not returned.
> >
> > rs is ADO recordset, from ADOInt.hpp.
> >
> > Recordset could be closed if your sp has some SQL commands that do not
> > return data as first instructions.
> >
> > //------------------------------------------
> > Regards,
> > Vassiliev V. V.
> > http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
> > ADO.Net
> > http://www.oledbdirect.com - The fastest way to access MS SQL Server,
> > MS Jet (Access) and Interbase (through OLEDB)
> >
> > "Paul Cheetham" <PAC.News@dsl.pipex.com> �������/�������� � ��������
> > ���������: news:MPG.1b99a114ae2276db98968f@Newsgroups.Borland.com...
> > >
> > > Hi,
> > >
> > > I have an application where I am trying to read data from an MS SQL
> > > table using stored procedures.
> > > I have created the stored procedure, and it works fine.
> > > If I use the code below, I get an error.
> > >
> > >
> > >
> > >   Command = new TADOCommand (NULL);
> > >   DataSet = new TADODataSet (NULL);
> > >   Command->Connection = _Connection;
> > >   Command->CommandType = cmdStoredProc;
> > >   Command->CommandText = "pr_tblCustomers_SelectOne_ByCustNo";
> > >   Command->Parameters->Clear();
> > >
> > >   Command->Parameters->CreateParameter ("@iiCustNo", ftInteger,
pdInput,
> > > 4, _iCustomerNumber);
> > >   Command->Parameters->CreateParameter ("@iiErrorCode", ftInteger,
> > > pdOutput, 4, 0);
> > >
> > >   // Execute command and return recordset.
> > >   DataSet->Recordset = Command->Execute();
> > >
> > >
> > > The line above generates the error  "Record set is not open"
> > > If I use the line:
>
> -- 
> Paul Cheetham
>
> "There are 10 types of people in the world - those that understand
> Binary, and those that don't."
Technical Details
Message-ID: <4132c5e2$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <MPG.1b99a114ae2276db98968f@Newsgroups.Borland.com> <41301f8a$1@newsgroups.borland.com> <MPG.1b9c0bf1ca2a52b4989690@Newsgroups.Borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,592a3d7e1719af81
X-Google-Attributes: gid10698b,public
X-Google-Language: ENGLISH,ASCII
From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com>
Newsgroups: borland.public.cppbuilder.database.ado
References: <MPG.1b99a114ae2276db98968f@Newsgroups.Borland.com> <41301f8a$1@newsgroups.borland.com> <MPG.1b9c0bf1ca2a52b4989690@Newsgroups.Borland.com>
Subject: Re: Assign to TADORecordSet
Date: Mon, 30 Aug 2004 10:14:45 +0400
Lines: 99
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
NNTP-Posting-Host: 213.234.218.42
Message-ID: <4132c5e2$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1093846498 213.234.218.42 (29 Aug 2004 23:14:58 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail