void CMyDAODlg::OnButtonSearch()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
if (m_cmbCondition.GetCurSel() == CB_ERR) //获取要查询的条件
return;
CString strCondition, strSQL;
m_cmbCondition.GetWindowText(strCondition);
//构造SQL语句
if(strCondition=="姓名")
strSQL.Format("select * from LinkInfo where Name Like '*%s*'", m_strQuery);
else if(strCondition=="电话")
strSQL.Format("select * from LinkInfo where Phone Like '*%s*'", m_strQuery);
else if(strCondition=="邮件")
strSQL.Format("select * from LinkInfo where Email Like '*%s*'", m_strQuery);
else if(strCondition=="地址")
strSQL.Format("select * from LinkInfo where address Like '*%s*'", m_strQuery);
else if(strCondition=="邮编")
strSQL.Format("select * from LinkInfo where postcode Like '*%s*'", m_strQuery);
ShowItem(strSQL); //在listControl中显示查询结果
UpdateData(FALSE);
}