VC++数据库学习笔记:ADO:: Connection 对象
2013-04-25 18:29
621 查看
VC++数据库学习笔记:
ADO:: Connection 对象
Attributes 属性
错误提示:“在事务处理过程中,连接对对象不能被明确地切断。“
pConnect->PutAttributes(adXactCommitRetaining);//这里不能修改连接对象的属性,不然会处理事备时会出错。
nAttrib = pConnect->GetAttributes();
cout<<"Attrib:"<<nAttrib<<endl;
cout<<"Provider:"<<(LPCSTR)pConnect->Provider<<endl;
cout<<"State:"<<pConnect->State<<endl;
cout<<"version:"<<(LPCSTR)pConnect->Version<<endl;
pConnect->BeginTrans();
pConnect->Execute("delete From employees where emp_id = 1",&vtMissing,adCmdText);
pConnect->CommitTrans();
BeginTrans不能嵌套,只能处理单一的事务
pConnect->BeginTrans()
pConnect->CommitTrans()
pConnection->Close() 不能处理已经关闭的对象,不然出错。
ADO:: Connection 对象
Attributes 属性
错误提示:“在事务处理过程中,连接对对象不能被明确地切断。“
pConnect->PutAttributes(adXactCommitRetaining);//这里不能修改连接对象的属性,不然会处理事备时会出错。
nAttrib = pConnect->GetAttributes();
cout<<"Attrib:"<<nAttrib<<endl;
cout<<"Provider:"<<(LPCSTR)pConnect->Provider<<endl;
cout<<"State:"<<pConnect->State<<endl;
cout<<"version:"<<(LPCSTR)pConnect->Version<<endl;
pConnect->BeginTrans();
pConnect->Execute("delete From employees where emp_id = 1",&vtMissing,adCmdText);
pConnect->CommitTrans();
BeginTrans不能嵌套,只能处理单一的事务
pConnect->BeginTrans()
pConnect->CommitTrans()
pConnection->Close() 不能处理已经关闭的对象,不然出错。
相关文章推荐
- 【VC++ 中使用ADO操作数据库学习笔记】_ConnectionPtr指针的基本用法
- [2004-8-4]VB.Net学习笔记,使用ADO.Net对象访问数据库,将结果写入ListView
- 【VC++ 中使用ADO操作数据库学习笔记】 基础环境的设置
- 孙鑫VC学习笔记:第二十讲 ado数据库编程
- delphi学习笔记--ADO数据库连接组件TADOConnection
- ADO.NET笔记——使用Connection连接数据库,使用Command对象的ExecuteReader()方法创建DataReader对象返回多行数据
- 袁芳的学习笔记(4)Predix对象数据库Blobstore
- 孙鑫VC学习笔记:第十六讲 利用事件对象实现线程间的同步
- VC++ ADO方式访问数据库简要笔记
- VC++下使用ADO操作数据库_ConnectionPtr、_RecordsetPtr和_CommandPtr(转)
- 黑马程序员_学习日记47_615数据库开发及ADO.Net(连接字符串、SqlDataReader对象、连接池)
- Greenplum+Hadoop学习笔记-14-定义数据库对象之创建与管理模式
- 孙鑫VC学习笔记:第二十讲 ado数据库编程
- 孙鑫VC学习笔记:第十三讲 (五) 保存可串行化的类对象 如何获取文档与视类指针
- Mybatis学习笔记:(二) java中的实体(对象、List、Set)关系怎样与数据库关联映射
- [ADO学习笔记] Recordset 对象中的updateBatch函数的使用方法
- VC++下使用ADO操作数据库的智能指针_ConnectionPtr、_RecordsetPtr、_CommandPtr的方法
- db4o_8.0对象数据库官方文档翻译_学习笔记三
- 执行数据库命令(Command对象)——ADO.NET学习&应用笔记之三
- VC学习笔记:ADO