_variant_t var;
int a=123456;
var=(long)a;
m_pRecordset->PutCollect("SATID",_variant_t("jianbing"));
m_pRecordset->PutCollect("GSID",_variant_t("asdf"));
m_pRecordset->PutCollect("START",var);
m_pRecordset->Update();
执行到update出错,未指定的错误
若此处按   F11单步执行     
    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;   
  }在(*)处出错  hr为负 
  这是什么错误   为什么数据不能更新另外,如果没有m_pRecordset->PutCollect("START",var);这句,即不插入数据,则更新是可以的,即可以把字符写进数据库,但有了数字就不行了,请达人指教。。这个问题缠绕很久很久了

解决方案 »

  1.   

    try catch 啊  try catch  为什么这么多人不喜欢你?try
    {
    }
        catch(_com_error &e)
        {
            ASSERT(FALSE);
            CString str;
            str.Format("执行SQL语句失败 错误原因 %s" , (LPCSTR)e.Description());
            TRACE(str);
            AfxMessageBox(str);    
            exit(1);
    }
      

  2.   

    可以插入字符不可以插入数值说明类型不对呗,数据库字段类型是char型的看看是不是这个问题