//代码目的:求所有记录中某列(long型)的最小值
//1.打开数据连接
BOOL CHistory::OpenRecordSet(CString& strSQL)
{
CBet14ToolApp* pApp=(CBet14ToolApp*)AfxGetApp();
//创建记录集对象
m_pRecordset.CreateInstance(__uuidof(Recordset));
//在ADO操作中建议语句中要常用try...catch()来捕获错误信息,
    //因为它有时会经常出现一些想不到的错误
try
{
//从数据库中打开表
m_pRecordset->Open(strSQL.AllocSysString(), 
pApp->m_pConnection.GetInterfacePtr(),
adOpenDynamic,
adLockOptimistic,
adCmdText);
}
catch (_com_error e)
{
CString strError;
strError.Format("警告: 打开数据表时发生异常。 错误信息: %s",\
e.ErrorMessage());
AfxMessageBox(strError);
return FALSE;
}
return TRUE;
}//2.组织SQL语句
long CHistory::GetItemStatisticValue(int statisKind,int item,int bigin,int end)
{
long statisticResult = ERRORDATA; //计算列列名
CString strColName("Number");

//计算SQL语句
CString strSQL; //获得最小值
strSQL.Format("SELECT MIN(%s) FROM History "strColName);

if(!OpenRecordSet(strSQL))
{
AfxMessageBox("没有成功打开数据表.");
strColName.Format(NULLSTR);
return ERRORDATA;
} if (NULL == m_pRecordset)
{
AfxMessageBox("没有成功打开数据表.");
strColName.Format(NULLSTR);
return ERRORDATA;
}
    
//获得统计值,怎么获得执行sql语句后的最小值?
//long state = m_pRecordset->GetState();
//PropertiesPtr pProperty = m_pRecordset->GetProperties();  
statisticResult = ???????????????????????????? return statisticResult;
}