错误描述,在按下添加按钮时,报错unknown error 0x800A0C93,通过调试,我初步确定错误出现在
语句:TESTHR(picRs->AddNew(&rs));
但往后就不知道了,还请高手指教源程序如下:
void CTaoGuanDlg::OnButtonadd() 
{
// TODO: Add your control notification handler code here if(!UpdateData())
return;
if(m_id==0)
{
AfxMessageBox("套管序号不能为空");
}
try
{
m_pRecordset->Open("select 序号 from 套管数据",(IDispatch*)m_pConnection,adOpenDynamic,adLockOptimistic,adCmdText);
int id=1;
if(!m_pRecordset->adoEOF)
{
_variant_t TheValue;
//从系列中获取新的序号
TheValue=m_pRecordset->Fields->GetItem((short)0)->Value;
id=TheValue.iVal;
}
m_pRecordset->Close(); CTaoGuanDataRs rs;
IADORecordBindingPtr picRs(m_pRecordset);
m_pRecordset->Open("select * from 套管数据 ",_variant_t((IDispatch*)m_pConnection,true),adOpenDynamic,adLockOptimistic,adCmdText);
//绑定记录集
TESTHR(picRs->BindToRecordset(&rs)); //给新添加的记录赋值
rs.m_l_id=m_id;
rs.m_d_tgwj=m_tgwj;
strcpy(rs.m_sz_tggcwj,m_tggcwj);
rs.m_d_tgbh=m_tgbh;
strcpy(rs.m_sz_jlw,m_jlw);
strcpy(rs.m_sz_nlw,m_nlw);
//调用IADORecordBing接口的AddNew方法添加新的数据,并显示到界面上
TESTHR(picRs->AddNew(&rs));
 CString str;

  str.Format("%d",id);
    m_listTGData.InsertItem(id,str);
 
             
 
      str.Format("%f",m_tgwj);
 m_listTGData.SetItemText(id,1,str);  
 m_listTGData.SetItemText(id,2,m_tggcwj);  str.Format("%f",m_tgbh);
 m_listTGData.SetItemText(id,3,str);  
m_listTGData.SetItemText(id,4,m_jlw);
 
 m_listTGData.SetItemText(id,5,m_nlw);
 m_pRecordset->Close();
 }

catch (_com_error e)
 {
 AfxMessageBox(e.ErrorMessage());
 }
}