CoInitialize(NULL);
_ConnectionPtr pConn(__uuidof(Connection));
pConn->ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=True;User ID=sa;Initial Catalog=qq";
pConn->Open("","","",adConnectUnspecified);
pConn->Execute((_bstr_t)str1,NULL,adCmdText);
//str1是语句
//str1.Format("select * from user_info where user_id = '%s' and user_pw = '%s'",theInfo->num,theInfo->pw);
//这里如何判断是否插入成功?
pConn.Release();
CoUninitialize();
_ConnectionPtr pConn(__uuidof(Connection));
pConn->ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=True;User ID=sa;Initial Catalog=qq";
pConn->Open("","","",adConnectUnspecified);
pConn->Execute((_bstr_t)str1,NULL,adCmdText);
//str1是语句
//str1.Format("select * from user_info where user_id = '%s' and user_pw = '%s'",theInfo->num,theInfo->pw);
//这里如何判断是否插入成功?
pConn.Release();
CoUninitialize();
解决方案 »
- 关于使用 GetRValue 的小问题
- dxshow能否控制扫描仪和数码相机
- ADO连sqlserver问题
- 怎么知道两个CTime对象之差正好相差一个月?
- 关于串口编程???
- 多文档,响应自己的按钮,打开一个FormView视图,但是为什么单击上面的button没相应?急!!!!
- 小弟在写界面时遇到了一点小问题,请教各位大虾,有关对话框的显示问题。分?没问题~~
- 急,请高人指点迷津!!!!!!!!!
- 有一个关于控件的常识问题请各位高手不吝指教..............................
- 为什么x64 上无法分配大内存块?
- 怎么让自己的VC程序使用脚本配置?
- ADO 调用函数的方法
如果用Execute插入,也可以通过错误捕捉知道成功与否。
只有update,好像是不知道成功与否的,因为就算没有一条数据被update,也不能认为是出错了。
pConn->Execute((_bstr_t)str1,NULL,adCmdText);只要没有返回错误就是插入成功了,没有必要检查的。