🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Assign to TADORecordSet

#1332
From: Paul Cheetham
Date: Fri, 27 Aug 2004 19:51
45 lines
1878 bytes
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:
  Command->Execute();
 it works fine, so the problem must be with assigning the returned 
recordset to the DataSet object.


Can anybody tell me where I am going wrong?

Thankyou.





-- 
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.1b99a114ae2276db98968f@Newsgroups.Borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!fu-berlin.de!newsfeed.iinet.net.au!newsfeed.iinet.net.au!PeerFeed.KWeb.on.ca!news.kweb.on.ca!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,592a3d7e1719af81,start
X-Google-Attributes: gid10698b,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: Paul Cheetham <PAC.News@dsl.pipex.com>
Newsgroups: borland.public.cppbuilder.database.ado
Subject: Assign to TADORecordSet
Date: Fri, 27 Aug 2004 20:51:24 +0100
Message-ID: <MPG.1b99a114ae2276db98968f@Newsgroups.Borland.com>
Organization: None
X-Newsreader: MicroPlanet Gravity v2.50
NNTP-Posting-Host: 81.86.138.235
X-Trace: newsgroups.borland.com 1093636248 81.86.138.235 (27 Aug 2004 12:50:48 -0700)
Lines: 46
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!fu-berlin.de!newsfeed.iinet.net.au!newsfeed.iinet.net.au!PeerFeed.KWeb.on.ca!news.kweb.on.ca!newsgroups.borland.com!not-for-mail