try
{
int id;
strSql.Format("delete ids where ID=%d",id);
    m_pRecordset->Open((_variant_t)strSql.AllocSysString(),
                (_variant_t)theApp.m_pConnection.GetInterfacePtr(),
adOpenDynamic,
adLockOptimistic,
adCmdText);
theApp.m_pConnection->Execute((_bstr_t)strSql,&RecordsAffected,adCmdText);
     
}

catch(_com_error *e)
{
CString Error=e->ErrorMessage();
AfxMessageBox(e->ErrorMessage());
}
catch(...)
{
AfxMessageBox("打开数据集出错!");
}
AfxMessageBox("删除成功!");
}