VC++数据库学习笔记:ADO:: Connection 对象

来源:互联网 发布:c语言求圆柱表面积 编辑:程序博客网 时间:2024/06/07 03:52

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() 不能处理已经关闭的对象,不然出错。


原创粉丝点击