vc中使用ADO删除Oracle表中一行数据
各位大侠~求救~删除表LOGINF中一行数据,出错啦~代码如下
- C/C++ code
void UserM::OnBUTTONdeletuser(){try { _variant_t vNULL; vNULL.vt=VT_ERROR; vNULL.scode=DISP_E_PARAMNOTFOUND; CString dstr; dstr.Format("delete from YYL.LOGINF where LINFID=14"); m_ado.m_pCommand->ActiveConnection=m_ado.m_pConnection; m_ado.m_pCommand->CommandText=_bstr_t(dstr); m_ado.m_pRecordset=m_ado.m_pCommand->Execute(&vNULL,&vNULL,adCmdText); } catch(_com_error e) //异常处理 { AfxMessageBox(e.Description()); }}
报错:First-chance exception in TransManager.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.
断点调试跟进后从下面这句直接进入catch 捕捉错误去了
m_ado.m_pCommand->ActiveConnection=m_ado.m_pConnection;
SQL语句没问题,已经在SQL plus中测试过
请各位路过帮偶看看~先行谢过啦!!!
另外,如果要从列表控件中获取所选记录,然后从数据库中删除~该怎么做呀~新鲜菜鸟求教中~
[解决办法]
连接对象打开没有:
HRESULT hr=m_pConnection->Open();