str.Format(_T("select FoodName,FoodPrice from [FoodManage].[dbo].[Caishiinfo]")); theApp.m_rsPtr=theApp.m_conPtr->Execute((_bstr_t(str)),NULL,adCmdText);
CString sName,sPrice;
while(!theApp.m_rsPtr->adoEOF)
{

sName=theApp.m_rsPtr->GetCollect("FoodName").bstrVal; sPrice.Format(_T("%0.2f"),theApp.m_rsPtr->GetCollect("FoodPrice").fltVal ); m_List_Caidan.AddString(sName + " " + sPrice ); theApp.m_rsPtr->MoveNext();
}数据库表如图: