Article View: borland.public.cppbuilder.database.ado
Article #3566Re: How to get the result "select count(*) from ..."
From: Peter Schoner
Date: Wed, 10 Jul 2002 15:53
Date: Wed, 10 Jul 2002 15:53
81 lines
3279 bytes
3279 bytes
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:
<3d2c5864_2@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!news.tele.dk!small.news.tele.dk!129.250.35.146!iad-peer.news.verio.net!news.verio.net!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnewsReferences:
<3d2c4602_1@dnews> <3d2c5267$1_1@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-10 10:21:32 PST From: "Peter Schoner" <schoner@wirtschaft.uni-kassel.de> Newsgroups: borland.public.cppbuilder.database.ado References: <3d2c4602_1@dnews> <3d2c5267$1_1@dnews> Subject: Re: How to get the result "select count(*) from ..." Date: Wed, 10 Jul 2002 17:53:51 +0200 Lines: 83 Organization: University of Kassel 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: 141.51.88.121 Message-ID: <3d2c5864_2@dnews> X-Trace: dnews 1026316388 141.51.88.121 (10 Jul 2002 08:53:08 -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!news.tele.dk!small.news.tele.dk!129.250.35.146!iad-peer.news.verio.net!news.verio.net!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews