当前位置:编程学习 > VB >>

100分:ACCESS2003事务处理的问题

开发环境vb6+access2003+ado

请问:

1、ACCESS2003+ADO是否支持事务控制。

2、我的这个惯用写法,是否存在问题
    sql1 = "Insert into 。。。。)"
    sql2 = " update yh set 。。。。。。"
    On Error GoTo ERRB
    Conn.BeginTrans
    Conn.Execute sql1, n1
    Conn.Execute sql2, n2
    If n1 <> 1 Or n2 <> 1 Then
        Conn.RollbackTrans
        MsgBox "  失败,请检查原因。 ", vbOKOnly, "提示"
        GoTo ERRC
     Else
        Conn.CommitTrans
     End If
private sub command1_click()
on error goto errhandle
    conn.begintrans 
    conn.execute "insert into ..."
    conn.execute "update ..."
    conn.execite "delete ..."
    conn.committrans
    exit sub
'错误处理
errhandle:
    conn.rollbacktrans
    msgbox "操作失败,错误原因为:" & err.description,vbexclamation,"提示"
    exit sub
end sub

http://hi.baidu.com/giver/blog/item/36b24bc2dd135227e4dd3b02.html
补充:VB ,  基础类
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,