void CExec4Dlg::OnButton1()
{
// TODO: Add your control notification handler code here
UpdateData();
if(m_sname == "" || m_sno == "")
{
AfxMessageBox("学号和姓名信息不能为空!");
return;
}
try
{
m_pRecordset->AddNew();
m_pRecordset->PutCollect("sno", _variant_t(m_sno));
m_pRecordset->PutCollect("sname", _variant_t(m_sname));
m_pRecordset->PutCollect("age", _variant_t(m_age));
m_pRecordset->PutCollect("dept", _variant_t(m_dept));
m_pRecordset->PutCollect("comment", _variant_t(m_comment));
m_pRecordset->Update();
UpdateData(false);
AfxMessageBox("插入成功!");
int nCurSel = m_list.GetCurSel();
List(); // m_list.SetCurSel(nCurSel);
OnSelchangeList1(); }
catch(_com_error *e)
{
AfxMessageBox(e->ErrorMessage());
}
}、
MFC 函数添加记录到数据库时候执行 至红色的代码发生了runtime错误,!!数据库是联通了,而且可以在列表框里显示和查找数据库的内容,就是插入和修改记录这两个功能一执行就会发生runtime错误。求大神帮忙分析下是什么原因,本人菜鸟刚学的。
{
// TODO: Add your control notification handler code here
UpdateData();
if(m_sname == "" || m_sno == "")
{
AfxMessageBox("学号和姓名信息不能为空!");
return;
}
try
{
m_pRecordset->AddNew();
m_pRecordset->PutCollect("sno", _variant_t(m_sno));
m_pRecordset->PutCollect("sname", _variant_t(m_sname));
m_pRecordset->PutCollect("age", _variant_t(m_age));
m_pRecordset->PutCollect("dept", _variant_t(m_dept));
m_pRecordset->PutCollect("comment", _variant_t(m_comment));
m_pRecordset->Update();
UpdateData(false);
AfxMessageBox("插入成功!");
int nCurSel = m_list.GetCurSel();
List(); // m_list.SetCurSel(nCurSel);
OnSelchangeList1(); }
catch(_com_error *e)
{
AfxMessageBox(e->ErrorMessage());
}
}、
MFC 函数添加记录到数据库时候执行 至红色的代码发生了runtime错误,!!数据库是联通了,而且可以在列表框里显示和查找数据库的内容,就是插入和修改记录这两个功能一执行就会发生runtime错误。求大神帮忙分析下是什么原因,本人菜鸟刚学的。
解决方案 »
- cocos2d-x 中,如何让runAction函数执行完后才返回
- MFC程序在使用中如何刷新程序配置的所有注册表
- 很初学的问题。
- VC中关于DTS的操作
- 大放分,最真心祝愿FreeSeagull (孤海闲鸥) 手术顺利成功!!!!!!!!!!!!!来者有分!
- realplay 控件的问题极简单快来拿分
- 急问!关于画标尺的问题
- fatal error LNK1169: one or more multiply defined symbols found
- 简单问题:如何去掉MDI窗口的菜单条?(帖主一直在线,问题解决,立马给分)
- 网络菜鸟提问
- [求助]UDP通信,数据报结构中包含IP地址,为何收到时为空?紧急!在线等。
- 很简单的问题一百分,求解答。
http://topic.csdn.net/t/20060709/10/4868751.html
不过,我觉得应该有个类似Commit的函数
是字符型的,改了以后编译报错。后来我用了insert 语句直接插 倒是可以成功了。改了两天了,不知道这是什么原因额 ?求大神指点。
那就直接用sql语句吧...方便,省事...