您的位置:首页 > 编程语言 > C语言/C++

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() 不能处理已经关闭的对象,不然出错。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐