Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Which variable holds the Count result? 1

Status
Not open for further replies.

Wavelet

Programmer
Apr 17, 2002
6
For example, when a SQL statement like this: Query1->SQL->Add("select count(*) from table where free=false") is executed and the result should be 5, my question is where can I find the variable that holds the result "5" ?
 
Hi there,

if your field has the Name of xy you can access it like
try
{
Query1->Open();
Query1->Fields->FieldByName( "COUNT OF xy" )->AsInteger;
Query1->Close();
}

Hope this will help

Benno
 
You can try also this:
Code:
Query1->SQL->Add("select count(*) AS Result from table where free=false");
Query1->Open();
int res = Query1Result->AsInteger;
Query1->Close();

The variable res will hold the value.

Bye.
Leonardo.

Leonardo Mattioli
Chief Program Manager
Z Forge snc -
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top