CRecordset *pSet = new CRecordset(&m_database);
try
{
  pSet->open(CRecordset::snapshot,'select count(xx) from aTable where xxx',CRcordset::none);
}catch(CDBException *e)
{
//you want to do
}
       CString tmp ;
  while(!pSet->IsEof() && pSet->GetODBCFieldCount() > 0)
  {       pSet->GetFieldValue((short)0,tmp);
   }
这里tmp识你想要的,
i have no msdn now ,and i did not write the code like this so long ,so it may be have something wrong but i think you will got it. if you want to got another type of this result ,just change it .