我在保存数据到数据库的时候出现如下的错误:
debug assertion failed
file dbcore.cppfor information on how your program can cause an assertion failure,see the visual c++ documentation on asserts.(press retry to debug th application)大家帮我看看是为什么?
出现错误时运行的代码:
void CJobfrm::OnSave()
{
// 保存新的职务信息
//先查询是否已经存在
int i;
CString tempclass,tempjob,inclass,jobid;
CJobSet myjobs;
UpdateData(TRUE);
m_classname.GetWindowText(inclass);
jobid.Format("%d",m_joblist.GetItemCount()+1);
for(i=0;i<m_joblist.GetItemCount();i++)
{
tempclass=m_joblist.GetItemText(i,0);
tempjob=m_joblist.GetItemText(i,1);
if (tempjob==m_jobname && tempclass==inclass)
{
//有相同的
MessageBox("已经有相同的部门职务","提示");
return;
}
else
{
//不相同的则添加
myjobs.Open(CRecordset::dynaset,"select * from JobTable"); myjobs.AddNew();
myjobs.m_Jid=jobid;
myjobs.m_Cname=inclass;
myjobs.m_Jname=m_jobname;
myjobs.Update();
CJobfrm::Inilist();
}
}
}
debug assertion failed
file dbcore.cppfor information on how your program can cause an assertion failure,see the visual c++ documentation on asserts.(press retry to debug th application)大家帮我看看是为什么?
出现错误时运行的代码:
void CJobfrm::OnSave()
{
// 保存新的职务信息
//先查询是否已经存在
int i;
CString tempclass,tempjob,inclass,jobid;
CJobSet myjobs;
UpdateData(TRUE);
m_classname.GetWindowText(inclass);
jobid.Format("%d",m_joblist.GetItemCount()+1);
for(i=0;i<m_joblist.GetItemCount();i++)
{
tempclass=m_joblist.GetItemText(i,0);
tempjob=m_joblist.GetItemText(i,1);
if (tempjob==m_jobname && tempclass==inclass)
{
//有相同的
MessageBox("已经有相同的部门职务","提示");
return;
}
else
{
//不相同的则添加
myjobs.Open(CRecordset::dynaset,"select * from JobTable"); myjobs.AddNew();
myjobs.m_Jid=jobid;
myjobs.m_Cname=inclass;
myjobs.m_Jname=m_jobname;
myjobs.Update();
CJobfrm::Inilist();
}
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货