问题描述:m_ComField, m_ComEmblem是连个组合框对象,m_adodc是个ADODC控件对象m_sCondition是CString,下面这段语句在通过if时的出错提示是,select附近有错误,通过else执行时 出现很多个终止程序对话框。希望各位大侠给予关注,谢谢。
CString sSQL,sField,sEmblem;
UpdateData(TRUE);
m_ComField.GetWindowText(sField);
m_ComEmblem.GetWindowText(sEmblem);
if(sEmblem!="LIKE")
sSQL.Format("select *from 客户 where %s %s %s",sField,sEmblem,m_sCondition);
else
sSQL.Format("select *from 客户 where %s LIKE '%%s%'",sField,m_sCondition);
m_adodc.SetRecordSource(sSQL);
m_adodc.Refresh();
CString sSQL,sField,sEmblem;
UpdateData(TRUE);
m_ComField.GetWindowText(sField);
m_ComEmblem.GetWindowText(sEmblem);
if(sEmblem!="LIKE")
sSQL.Format("select *from 客户 where %s %s %s",sField,sEmblem,m_sCondition);
else
sSQL.Format("select *from 客户 where %s LIKE '%%s%'",sField,m_sCondition);
m_adodc.SetRecordSource(sSQL);
m_adodc.Refresh();
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货