<
%
On Error Resume Next ' 错误发生后继续处理
' Asp中使用事务
Set conn = Server.CreateObject( " ADODB.Connection " )
conn.Open " course_dsn " , " course_user " , " course_password "
conn.begintrans ' 开始事务
sql = " delete from user_info "
set rs = server.createobject( " adodb.recordset " )
rs.open sql,conn, 3 , 3
if conn.errors.count > 0 then ' 有错误发生
conn.rollbacktrans ' 回滚
set rs = nothing
conn.close
set conn = nothing
response.write " 交易失败,回滚至修改前的状态! "
response.end
else
conn.committrans ' 提交事务
set rs = nothing
conn.close
set conn = nothing
response.write " 交易成功! "
response.end
end if
% >
On Error Resume Next ' 错误发生后继续处理
' Asp中使用事务
Set conn = Server.CreateObject( " ADODB.Connection " )
conn.Open " course_dsn " , " course_user " , " course_password "
conn.begintrans ' 开始事务
sql = " delete from user_info "
set rs = server.createobject( " adodb.recordset " )
rs.open sql,conn, 3 , 3
if conn.errors.count > 0 then ' 有错误发生
conn.rollbacktrans ' 回滚
set rs = nothing
conn.close
set conn = nothing
response.write " 交易失败,回滚至修改前的状态! "
response.end
else
conn.committrans ' 提交事务
set rs = nothing
conn.close
set conn = nothing
response.write " 交易成功! "
response.end
end if
% >