MMTTMM
pCommand->CommandText = "SELECT * FROM XXX";pRecordset=pCommand->Execute(NULL,NULL,adCmdText);这就会执行那句select语句。至于你说的放哪,就又你自己决定,我猜你是想放列表控件里面。这样的话 你就直接显示在列表控件中就是了。代码如下:int cols = pRecordset->GetFields()->Count;//获取列数if (data_name!=NULL){delete []data_name;}data_name = new CString[cols];_variant_t get_name;//读取字段名for (int i=0;i<cols;i++){get_name = pRecordset->GetFields()->GetItem(_variant_t(short(i)))->GetName();if (get_name.vt==VT_NULL){data_name[i].Empty();}elsedata_name[i] = (LPCTSTR)(_bstr_t)get_name;int nWidth = listctrl.GetStringWidth(data_name[i]) + 60;listctrl.InsertColumn(i, data_name[i], LVCFMT_LEFT, nWidth);}int nCount =0;//获取数据CString lptext;bool f =false;CString k("0");while (!pRecordset->GetadoEOF ()){listctrl.InsertItem(nCount,k);for (int j=0;j<cols;j++){get_name = pRecordset->GetFields()->GetItem(_variant_t(short(j)))->GetValue();if (get_name.vt==VT_NULL){lptext.Empty();}elselptext = (LPCTSTR)(_bstr_t)get_name;listctrl.SetItemText(nCount,j,lptext);}pRecordset->MoveNext();nCount++;}pRecordset->Close();