🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: How to get the result "select count(*) from ..."

#3571
From: Arnie Mauer
Date: Thu, 11 Jul 2002 14:29
92 lines
3640 bytes
What database engine are you using?  Are you using ODBC or a native OLEDB
driver?


"Peter Schoner" <schoner@wirtschaft.uni-kassel.de> wrote in message
news:3d2c5864_2@dnews...
> Hi Arnie!
>
> Yes, that is the way I tried to work it out. Yet I don't have the problem
to
> get the data with
> qry->FieldByname( "MyCount" )->AsInteger;
>
> The problem is that I simply cannot passthrough the query
> "select count(*) MyCount from ATable where x=25"
>
> as count(*) is an aggregate function. I know that MS Access (or Interbase,
> ORACLE) could work with it. But I get the error message
> "project raised exception classEDBEngineError with message 'Table is read
> only'".
>
> Does anyone has a glue how to solve it. I wonder why this is not possible
> with BCB5!
>
>
> Peter
>
> "Arnie Mauer" <amauer@vrms.com> schrieb im Newsbeitrag
> news:3d2c5267$1_1@dnews...
> > Hi Peter,
> >
> > If I understand you correctly, something like:
> > qry->SQL->Add( "select count(*) MyCount from ATable where x=25" );
> > qry->Open();
> > int myCount = qry->FieldByname( "MyCount" )->AsInteger;
> >
> > - Arnie
> >
> > "Peter Schoner" <schoner@wirtschaft.uni-kassel.de> wrote in message
> > news:3d2c4602_1@dnews...
> > > Hi!
> > >
> > > I am very familiar with SQL but not with the complete BCB5
> possibilities.
> > >
> > > I simply wanted to get a number of records with
> > > Form1->SQL_Params->SQL->Add("select count(*) from T_output where
i_Reakt
> =
> > > 'R01'");
> > >
> > > or the values
> > > Form1->SQL_Params->SQL->Add("select diestinct i_Reakt from T_output");
> > >
> > >
> > > However the help file says:
> > > "A live result set for a query against a single table or view is
> returned
> > if
> > > the query does not contain any of the following:
> > >
> > > DISTINCT in the SELECT clause
> > >  Joins (inner, outer, or UNION)
> > >  Aggregate functions with or without GROUP BY or HAVING clauses
> > >  Base tables or views that are not updatable
> > >  Subqueries
> > >  ORDER BY clauses not based on an index"
> > >
> > >
> > > So, how can I ask these questions to my database? It does not work
with
> > > TQuery! Does it work TIBQuery?
> > >
> > >
> > > Thanks in advance
> > > Peter
> > >
> > > .........................
> > > Dipl.-Math. Peter Schoner
> > > MAIL: schoner@wirtschaft.uni-kassel.de
> > >
> > > Uni Kassel -- Wirtschaftswissenschaften
> > > FG Produktionswirtschaft und Logistik
> > > www.wirtschaft.uni-kassel.de/vahrenkamp
> > >
> > > Nora-Platiel-Str. 4 -- 34127 Kassel
> > >
> > >
> >
> >
>
>
Technical Details
Message-ID: <3d2d96cf$1_1@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-xit-08!supernews.com!newsfeed.news2me.com!opentransit.net!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.esat.net!lnewspeer01.lnd.ops.eu.uu.net!emea.uu.net!newsfeed01.sul.t-online.de!t-online.de!dnews
References: <3d2c4602_1@dnews> <3d2c5267$1_1@dnews> <3d2c5864_2@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,bcad3e0669853dd8
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2002-07-11 08:10:25 PST
From: "Arnie Mauer" <amauer@vrms.com>
Newsgroups: borland.public.cppbuilder.database.ado
References: <3d2c4602_1@dnews> <3d2c5267$1_1@dnews> <3d2c5864_2@dnews>
Subject: Re: How to get the result "select count(*) from ..."
Date: Thu, 11 Jul 2002 10:29:07 -0400
Lines: 94
Organization: VRMS
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-Mimeole: Produced By Microsoft MimeOLE V6.00.2600.0000
NNTP-Posting-Host: 209.140.211.97
Message-ID: <3d2d96cf$1_1@dnews>
X-Trace: dnews 1026397903 209.140.211.97 (11 Jul 2002 07:31:43 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-xit-08!supernews.com!newsfeed.news2me.com!opentransit.net!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.esat.net!lnewspeer01.lnd.ops.eu.uu.net!emea.uu.net!newsfeed01.sul.t-online.de!t-online.de!dnews