c++ Ado _RecordsetPtr.Update() abort R6010

rs.Update() 是 由于更新了主键有重复,导致失败,但是VS自动封装的_RecordsetPtr没有抛出异常,直接就abort r6010

 

解决方法

inline HRESULT Recordset15::Update ( const _variant_t & Fields, const _variant_t & Values ) {
    HRESULT _hr = raw_Update(Fields, Values);
    if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
    return _hr;
}

  上面是原来的msado15.tli的内容

 

自己封装个函数修改成 :

HRESULT hr = pRs->raw_Update();
    if(FAILED(hr))
    {
        _ConnectionPtr conn = (IDispatch *)pRs->GetActiveConnection();
        _com_issue_errorex(hr,conn,__uuidof(conn));
        return FALSE;
    }else{
        return TRUE;
    }

 

posted on 2013-07-22 14:40  单行道的转角  阅读(738)  评论(0编辑  收藏  举报

导航