Click to See Complete Forum and Search --> : "Select Count(*) ..." in ADO


Vanessa Li
April 13th, 1999, 07:56 PM
How do I get the result of "Select Count(*) From MyTable"
in ADO? My program environment is VC6.0.
which ADO object (i.e. connection, command, etc) to use and
which method?

Thanks,
Vanessa Li

Vanessa Li

Bob Place
April 15th, 1999, 07:37 AM
If you want to use the GetCollect method of a recordset you can do this. Change the SQL to SELECT COUNT(*) FROM table AS total_count. Then use the getcollect method:

_variant_t Holder = MySet->GetCollect("total_count");

Holder.ival will have your value in it.

Bob

Tonio
June 22nd, 1999, 01:57 AM
Good Day!
How should I declare the "total_count", should it be a field in my table?
or is it automatically created temporarily at runtime?
TIA

Bob Place
June 22nd, 1999, 10:11 AM
It is automaticly sreated in the returned recordset. If you go to MSQuery (or any other tool) and type the SQL in, you will see it listed as a column name.

bob