读者朋友:
您好,可以参考下面的代码:
CComboBox m_namelist;
_RecordsetPtr rec;
ado.Execute(_T("use ["master"]"));
rec = ado.Query(_T("select * from sysdatabases"));
int index = 0;
while(!rec->adoEOF){//rec为执行sql操作后返回的值
m_namelist.InsertString(index, rec->GetCollect(_T("cAcc_Name")).bstrVal);
rec->MoveNext();
index++;
}