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)
%
>
posted @ 2007-01-04 17:11  Athrun  阅读(1200)  评论(1编辑  收藏  举报