🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Assign to TADORecordSet

#1334
From: Paul Cheetham
Date: Sun, 29 Aug 2004 15:51
73 lines
3116 bytes
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: <MPG.1b9c0bf1ca2a52b4989690@Newsgroups.Borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!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>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,592a3d7e1719af81
X-Google-Attributes: gid10698b,public
X-Google-Language: ENGLISH,ASCII
From: Paul Cheetham <PAC.News@dsl.pipex.com>
Newsgroups: borland.public.cppbuilder.database.ado
Subject: Re: Assign to TADORecordSet
Date: Sun, 29 Aug 2004 16:51:53 +0100
Message-ID: <MPG.1b9c0bf1ca2a52b4989690@Newsgroups.Borland.com>
References: <MPG.1b99a114ae2276db98968f@Newsgroups.Borland.com> <41301f8a$1@newsgroups.borland.com>
Organization: None
X-Newsreader: MicroPlanet Gravity v2.50
NNTP-Posting-Host: 81.86.138.235
X-Trace: newsgroups.borland.com 1093794701 81.86.138.235 (29 Aug 2004 08:51:41 -0700)
Lines: 73
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail