ASP中使用事务的例子。已经测试通过。

<%
on error resume next
Set conn=Server.CreateObject("ADODB.CONNECTION")
conn.Open Application("ConnectionString")
Conn.BeginTrans

conn.execute("Insert into text(text)values('abc')")
'
conn.execute("Insert into text123(text)values('123')")

if conn.Errors.Count>0 then
conn.Errors.Clear
conn.RollBackTrans
response.Write("error,had RollBack.")
end if
conn.CommitTrans
%>

你可能感兴趣的:(asp)