//查找用户是否存在
CString sql;
sql.Format ("select Name form UserCommunications where Name='%s' ",m_strName);
CAddressListApp* pApp=(CAddressListApp*)AfxGetApp();
HRESULT HR=pApp->m_pRs->Open(sql.AllocSysString (),pApp->m_pConn.GetInterfacePtr (),adOpenDynamic,adLockOptimistic,adCmdText);//调试时光标走到此就报错,请问是什么原因,怎样解决此问题?初学,有很多不懂请多多指教.
if(!pApp->m_pRs->adoEOF)
{
AfxMessageBox("此通讯人已存在,请重新输入或点击查找菜单查找此人信息!");
pApp->m_pRs ->Close ();
return;
}
CString sql;
sql.Format ("select Name form UserCommunications where Name='%s' ",m_strName);
CAddressListApp* pApp=(CAddressListApp*)AfxGetApp();
HRESULT HR=pApp->m_pRs->Open(sql.AllocSysString (),pApp->m_pConn.GetInterfacePtr (),adOpenDynamic,adLockOptimistic,adCmdText);//调试时光标走到此就报错,请问是什么原因,怎样解决此问题?初学,有很多不懂请多多指教.
if(!pApp->m_pRs->adoEOF)
{
AfxMessageBox("此通讯人已存在,请重新输入或点击查找菜单查找此人信息!");
pApp->m_pRs ->Close ();
return;
}
解决方案 »
- VC写界面,装入JPG图片的问题.
- 撒分,wtl中Richeditctrl中显示图片,做了很久都没成功,大虾帮忙
- VC中怎么取文件夹和文件的所有者属性呀?
- 自动关闭创建的MessageBox,PostMessage函数。
- ISAPI如何判断文件类型
- 平时积累的有关MSDN 里ActiveX开发技术的一些链接.
- 高手请解释一下,为什么会这样???为什么会这样???是不是VC的BUG啊!
- 请教四个CDC类的函数SetWindowOrg(),SetViewportOrg(),SetWindowExt(),SetViewportExtt()
- WinAPI参数列表的_in的具体含义是什么?
- 使用Microsoft forms2.0 Label控件怎样在干净的操作系统上注册?
- 如何mfc开发的activex控件返回一个数组?
- 怎样(用VC)导出某个asm(pro/e)包括的所有prt文件?
{
}
catch (_com_error& e)
{
_dump_com_error (e)
}
sql.Format ("select Name form UserCommunications where Name='%s' ",m_strName);
改成
sql.Format ("select Name from UserCommunications where Name='%s' ",m_strName);
sql = sql + "'"+ m_strName +"'";
这样来执行!