BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SQL Count(*)

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers)
View previous topic :: View next topic  
Author Message
Craig Leidy
Guest





PostPosted: Thu Sep 18, 2003 4:04 pm    Post subject: SQL Count(*) Reply with quote



I'm executing "Select Count(*) from Res"
If I use the Advantage Sql Tool I get 21.
How do I get this number into a variable
in my Delphi program?

Thanks, Craig.



Back to top
Mel Weaver
Guest





PostPosted: Thu Sep 18, 2003 4:10 pm    Post subject: Re: SQL Count(*) Reply with quote



N1 = integer;
Select Count(*) as n1 from Res;


"Craig Leidy" <surfsoft (AT) comcast (DOT) net> wrote

Quote:
I'm executing "Select Count(*) from Res"
If I use the Advantage Sql Tool I get 21.
How do I get this number into a variable
in my Delphi program?

Thanks, Craig.






Back to top
Ray Marron
Guest





PostPosted: Thu Sep 18, 2003 4:11 pm    Post subject: Re: SQL Count(*) Reply with quote



Craig Leidy <surfsoft (AT) comcast (DOT) net> wrote

Quote:
I'm executing "Select Count(*) from Res"
If I use the Advantage Sql Tool I get 21.
How do I get this number into a variable
in my Delphi program?

If you're using this SQL in some sort of dataset-descendant component, it
will be the value of the first and only field in the one-record dataset:
MyQuery.Fields[0].AsInteger

--
Ray Marron



Back to top
Bill Todd
Guest





PostPosted: Thu Sep 18, 2003 4:27 pm    Post subject: Re: SQL Count(*) Reply with quote

Assuming you are using a TAdsQuery component in your Delphi Program:

var
Cnt: Integer;
begin
Cnt := Qry.Fields[0].AsInteger;



--
Bill (TeamB)
(TeamB cannot respond to questions received via email)
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.