回滚

来源:互联网 发布:less 自动编译 VScode 编辑:程序博客网 时间:2024/04/27 18:06


<%@ TRANSACTION = Required %>

<!--#include file="conn.asp"-->

<%
 on error resume next
 
 conn.execute "Insert Into aaa(name) values(getdate())"  '这句没有问题
    conn.execute "Insert Into aaa(name2) values(getdate())"  '这句有问题,name2字段不存在
    conn.execute "Insert Into aaa(name) values(getdate())"  '这句没有问题
   
   
    '在这里做你的工作。。。。
   
   
    '直到最后再判断。
    'if conn.Errors.count>0 then
    if err then
     ObjectContext.SetAbort     '回滚
    else
     ObjectContext.SetComplete    '提交
    end if
   
    Sub OnTransactionAbort
  Response.Write "错误"     '可以略去
 End Sub
 
 Sub OnTransactionCommit
  Response.Write "胜利完成任务"   '可以略去
 End Sub
%>

原创粉丝点击