ASP中應用BeginTrans的例子
<!--#include file="uty.asp" -->
<%if session("uid")="" then%>
<script language="javascript">alert("<%=session_timeout%>");location.href="login.asp";</script>
<%end if%>
<%
i=request("txt_i")
d11=request("d1")
d2=request("d2")
sup_id=request("sup_id")
url="account_payable_stat.asp?d1="+d1+"&d2="+d2+"&sup_id="+sup_id
if i<>"" then
set conn=opendb()
for j=1 to i
if request("ckb_"+cstr(j))<>"" then
conn.BeginTrans
sql="update pur set pur_status='5' where pur_id='"&request("ckb_"+cstr(j))&"'"
conn.execute(sql)
sql_m="insert into pur_memo(pur_id,pur_status_old,pur_status_new,pur_memo,pur_memo_uid,pur_memo_date)"&_
" values('"&request("ckb_"+cstr(j))&"','3','5','轉應付帳款','"+session("uid")+"',getdate())"
conn.execute(sql_m)
conn.CommitTrans
end if
next
conn.close
end if
response.redirect(url)
%>
<%if session("uid")="" then%>
<script language="javascript">alert("<%=session_timeout%>");location.href="login.asp";</script>
<%end if%>
<%
i=request("txt_i")
d11=request("d1")
d2=request("d2")
sup_id=request("sup_id")
url="account_payable_stat.asp?d1="+d1+"&d2="+d2+"&sup_id="+sup_id
if i<>"" then
set conn=opendb()
for j=1 to i
if request("ckb_"+cstr(j))<>"" then
conn.BeginTrans
sql="update pur set pur_status='5' where pur_id='"&request("ckb_"+cstr(j))&"'"
conn.execute(sql)
sql_m="insert into pur_memo(pur_id,pur_status_old,pur_status_new,pur_memo,pur_memo_uid,pur_memo_date)"&_
" values('"&request("ckb_"+cstr(j))&"','3','5','轉應付帳款','"+session("uid")+"',getdate())"
conn.execute(sql_m)
conn.CommitTrans
end if
next
conn.close
end if
response.redirect(url)
%>
申明
非源创博文中的内容均收集自网上,若有侵权之处,请及时联络,我会在第一时间内删除.再次说声抱歉!!!
博文欢迎转载,但请给出原文连接。