+ -
当前位置:首页 → 问答吧 → MFC中操作ACCESS添加新数据是提示参数不足是什么意思,怎么解决

MFC中操作ACCESS添加新数据是提示参数不足是什么意思,怎么解决

时间:2011-12-24

来源:互联网

这个是添加数据的代码

void CBeta1View::OnAdd() 
{
CAdd_Modify dlg;
//m_pSet->MoveLast();
m_pSet->AddNew();
if(dlg.DoModal() == IDOK)
{
  m_pSet->m_Name = dlg.m_name;
m_pSet->m_Gender = dlg.m_gender;
m_pSet->m_Birthday = dlg.m_birthday;
m_pSet->m_Certificate = dlg.m_certificate;
m_pSet->m_CertificateNo = dlg.m_certificateNo;
  m_pSet->m_Degree = dlg.m_degree;
m_pSet->m_GraduateDate = dlg.m_graduateDate;
m_pSet->m_GraduatePer = dlg.m_graduatePer;
  m_pSet->m_Nation = dlg.m_nation;
  m_pSet->m_National = dlg.m_national;
m_pSet->m_ResearchDir = dlg.m_reserchDir;
  m_pSet->m_Title = dlg.m_title;
  m_pSet->m_GraduateSchool = dlg.m_graduateSchool;

m_pSet->Update();
//m_pSet->Requery();
m_pSet->MoveLast();
UpdateData(false);
}
}

这个是DEBUG是出现问题的代码 终止于红色那一行,p_Set在前面还有信息,一直到绿色那行就变为

TRY
{
#ifndef _AFX_NO_OCC_SUPPORT
// special case for WM_DESTROY
if ((nMsg == WM_DESTROY) && (pWnd->m_pCtrlCont != NULL))
pWnd->m_pCtrlCont->OnUIActivate(NULL);
#endif

// special case for WM_INITDIALOG
CRect rectOld;
DWORD dwStyle = 0;
if (nMsg == WM_INITDIALOG)
_AfxPreInitDialog(pWnd,&rectOld,&dwStyle);

// delegate to object's WindowProc
lResult = pWnd->WindowProc(nMsg,wParam,lParam);
// more special case for WM_INITDIALOG
if (nMsg == WM_INITDIALOG)
_AfxPostInitDialog(pWnd,rectOld,dwStyle);
}
CATCH_ALL(e)
{
CWinThread* pWinThread = AfxGetThread();
if ( pWinThread != NULL )
{
lResult = pWinThread->ProcessWndProcException(e,&pThreadState->m_lastSentMsg);
TRACE1("Warning: Uncaught exception in WindowProc (returning %ld).\n",
lResult);
}
else
{
TRACE0("Warning: Uncaught exception in WindowProc.\n");
lResult = 0;
}
DELETE_EXCEPTION(e);
}
END_CATCH_ALL

pThreadState->m_lastSentMsg = oldState;
return lResult;
}

小弟刚接触MFC,求各位大大指教。

作者: IceKnc   发布时间: 2011-12-24

不是MFC的问题,

字段有不比配的值,或缺少字段没有添加。

作者: chinatcp   发布时间: 2011-12-24