具体就是选择m_shujuleixing组合框项时,搜索查询相应数据结果却对应不上。
int nIndex=m_shujuleixing.GetCurSel();
中nIndex的值是不是      m_shujuleixing.InsertString(0,"请选择...");
      m_shujuleixing.InsertString(1,"水位");
  m_shujuleixing.InsertString(2,"水温");
  m_shujuleixing.InsertString(3,"水压");
中的0,1,2,3呢,应该就是的呀,因为我获取的就是那个的值,但是查询输出却不对应,无论选什么都是默认第一项。
BOOL CShuiwencanshuDlg::OnInitDialog() 
{
CDialog::OnInitDialog();

// TODO: Add extra initialization here      int i=1;
      m_shujuleixing.InsertString(0,"请选择...");
      m_shujuleixing.InsertString(1,"水位");
  m_shujuleixing.InsertString(2,"水温");
  m_shujuleixing.InsertString(3,"水压");
  m_shujuleixing.SetCurSel(0);   return TRUE;  // return TRUE unless you set the focus to a control
              // EXCEPTION: OCX Property Pages should return FALSE
}
////////向列表框中添加sql查询的数据////////
void CShuiwencanshuDlg::OnCanshuleixingxuanzeQueding() 
{
// TODO: Add your control notification handler code here    CAdo* ado = new CAdo();
int nIndex=m_shujuleixing.GetCurSel(); if(nIndex=0)
{
    MessageBox("请选择数据参数类型!");
return;
}
else if (nIndex=1)
{
   ado->m_pRecordset=ado->m_pConnection->Execute("SELECT Code FROM B_SensorInfo WHERE (SensorTypeName = '标高')",NULL,adCmdText);
    while(!ado->m_pRecordset->adoEOF)
{
  ((CListBox*)GetDlgItem(IDC_LIST_SHUJUCANSHU))->AddString(
(_bstr_t)ado->m_pRecordset->GetCollect("Code"));
ado->m_pRecordset->MoveNext();
}
return;
}
     else if (nIndex=2)
 {
         ado->m_pRecordset=ado->m_pConnection->Execute("SELECT Code FROM B_SensorInfo WHERE (SensorTypeName = '温度')",NULL,adCmdText);
      while(!ado->m_pRecordset->adoEOF)
{
        ((CListBox*)GetDlgItem(IDC_LIST_SHUJUCANSHU))->AddString(
        (_bstr_t)ado->m_pRecordset->GetCollect("Code"));
            ado->m_pRecordset->MoveNext();
}
return;
 }       else if (nIndex=3)
  {
      ado->m_pRecordset=ado->m_pConnection->Execute("SELECT Code FROM B_SensorInfo WHERE (SensorTypeName = '压力')",NULL,adCmdText);
        while(!ado->m_pRecordset->adoEOF)
{
              ((CListBox*)GetDlgItem(IDC_LIST_SHUJUCANSHU))->AddString(
              (_bstr_t)ado->m_pRecordset->GetCollect("Code"));
                  ado->m_pRecordset->MoveNext();
}
      return;
  }
ado->m_pRecordset->Close();
ado->m_pConnection->Close();
ado->m_pRecordset.Release();
ado->m_pConnection.Release();