🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: passing a record set to a routine

#2772
From: Viatcheslav V. Vassiliev
Date: Thu, 03 Apr 2003 05:46
71 lines
3181 bytes
May be because you return nothing from sMean (there is not "return ...;"
inside). If not, trace your program and determine exact line where you get
an exception.

----------------------------------------------------------------
Regards,
Viatcheslav V. Vassiliev
http://www.oledbdirect.com
The fastest way to access MS SQL Server, MS Jet (MS Access)
and Interbase (through OLEDB) databases.

"Mike McCann" <mmc@systemsthinking.com.au> �������/�������� � ��������
���������: news:3e8b601c@newsgroups.borland.com...
> Can someone please tell me what I've done wrong here.  I try to pass the
> recordset object to the called routine, and in the called routine, I get
> pointer fault when I try to access the record set properties or methods
>
> I know it's just my error
>
> Thanks
>
> =======================
> Caller:
> //  Fills a RecordSet with data
> // calls a routine to process the recordset
>
> #include "main.h"
> #include "ADODB_TLB.h"
>
>    TCOM_Connection cn = CoConnection::Create();
>     cn->ConnectionString = WideString("DSN=localserver").Detach();
>     cn->CursorLocation = Adodb_tlb::adUseClient;
>     cn->Open(0,0,0,0);
>     WideString sql = "SELECT Title FROM response ";
>     TCOM_Recordset rs = CoRecordset::Create();
>     rs->Open(sql.Detach(), (IDispatch *)cn, Adodb_tlb::adOpenDynamic,
> Adodb_tlb::adLockOptimistic, 0);
>     TStatsCalculator *myCalculator = new TStatsCalculator();
>     Edit4->Text = FloatToStr(myCalculator->sMean(rs));
>
> }
>
> =========================================================
>
> Called Routine Header file
> ===============================================
>
> #include "ADODB_TLB.h"
> class TStatsCalculator
> {
> private:
>
> public:
>         TStatsCalculator(void);
>         ~TStatsCalculator(void);
>
> double TStatsCalculator::sMean(TCOM_Recordset& rs);
>
> };
> =========================================================
>
> Called Routine main file
> ===============================================
> double TStatsCalculator::sMean(TCOM_Recordset& rs)
> {
>
>     double localMean = 0.0;
>     double numberRecords = rs->RecordCount;
> }
>
>
Technical Details
Message-ID: <3e8bcc98$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-04!sn-xit-06!sn-xit-01!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3e8b601c@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10698b,aa52e8a79c5f769
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2003-04-02 22:00:03 PST
From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com>
Newsgroups: borland.public.cppbuilder.database.ado
References: <3e8b601c@newsgroups.borland.com>
Subject: Re: passing a record set to a routine
Date: Thu, 3 Apr 2003 09:46:04 +0400
Lines: 73
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 213.247.201.57
Message-ID: <3e8bcc98$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1049349272 213.247.201.57 (2 Apr 2003 21:54:32 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-04!sn-xit-06!sn-xit-01!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail