我通过 CString strSqlCommand;
CString find;
find=m_findphone_num;
strSqlCommand = "SELECT * FROM 模块局账目表 where phone='" + find+"'";
try
{
//int i;
//if((m_pURLCon->Execute(strSqlCommand.AllocSysString(), NULL,adOpenUnspecified))i=1;
m_pURLRecordset = m_pURLCon->Execute(strSqlCommand.AllocSysString(), NULL,adOpenUnspecified);

}
catch(_com_error &e)
{
_bstr_t bstrSource(e.Source());
_bstr_t bstrDesc(e.Description());
CString psError;
psError.Format("Source:%s\nDesc:%s\nNumber:%u",(LPCTSTR)bstrSource,(LPCTSTR)bstrDesc,e.Error);
AfxMessageBox(psError);
return ;
}
查询数据库。
如果数据库中没有我要查询的结果的时候,程序就会报错,然后程序终止。
如何能不让程序终止,而让用户从新输入查询条件,直到查到为止。