void CAddStore::OnOk() 
{
CString strsql;
strsql.Format("SELECT * FROM TEST WHERE ID='%s'",m_Id);
m_pRecordset.CreateInstance("ADODB.Recordset");
m_pRecordset->Open(strsql.AllocSysString(),theApp.m_pConnection.GetInterfacePtr(),adOpenDynamic,adLockOptimistic,adCmdText);

if(UpdateData())
if(m_pRecordset->BOF)
{
AfxMessageBox("不存在");
}
else
AfxMessageBox("存在");
}
我想检测我输入的数据m_Id是否存在
build后能执行但总是说“不存在”
其实我有一个记录是ID是1可我输入1时就是说“不存在”
当我改成
m_pRecordset->Open("SELECT * FROM TEST WHERE ID= 1", theApp.m_pConnection.GetInterfacePtr(),adOpenDynamic,adLockOptimistic,adCmdText);
正常能提示"存在"
不知是什么问题
大家帮帮忙