ADO方式连接数据库,从数据表中读取id填入Control list,debug的时候程序不进入这些代码,要添加一个响应才行,这种怎么解决比较好
void Ctest3Dlg::OnCbnSelchangeCombo2()
{
CString ceshi;
try
{
CString search_sql;
search_sql.Format(_T("SELECT * FROM command"));
m_pRecordset = ((Ctest3Dlg*)(AfxGetMainWnd()))->m_pConnection->Execute(search_sql.AllocSysString(), NULL, adCmdText);
while (!m_pRecordset->adoEOF)
{
ceshi = m_pRecordset->GetCollect("id").bstrVal;
m_combo2.AddString(ceshi);
m_pRecordset->MoveNext();
((CComboBox*)GetDlgItem(IDC_COMBO2))->SetCurSel(3);
}
m_pRecordset->Close();
}
catch (_com_error e)
{
AfxMessageBox(_T("测试失败!"));
return;
}
}