Conn.RollBackTrans使用

来源:互联网 发布:二手车价格计算器软件 编辑:程序博客网 时间:2024/06/02 14:18

'--------------ATM密码验证-------------------
    atm_pwd=trim(request.form("atm_pwd"))
   
   if len(atm_pwd)<>6 then
    call openw("ATM服务密码长度为6位","")
    response.end
   end if
      
   UID=get_dvid(session("username"),"username")
   call check_userinfo(UID,2,2,1,atm_pwd,1)
   '--------------------------------------------

    sql="select money from [user] where username='" & session("username") & "'"
   MyMoney=cdbl(conn.execute(sql)(0))
   
   if not isnumeric(Request("CsMoney")) then
    call openw("注入酷币必须为数字!","")
   end if
   if request("csmoney") <1 then
    call openW("酷币不能为负数或零!","")
   end if
   
   if  request("csmoney") >10000 then
    call openw("每次注入的酷币不得大于10000","")
   end if

   if cdbl(Request("CsMoney"))>MyMoney then
    call openw("您注入的酷币大于你拥有的酷币!","")
   end if
   
   if lenB(Request("sDemo"))>200 then
    call openw("您留言不能超过100个汉字!","")
   end if

            '############检测酷币来源#############
            '   call  checkmoney(Request("CsMoney"))
   conn.errors.clear
   Conn.BeginTrans
   
   'moduleid 1 为 社员加入酷币到社团中  2 为 社团将酷币 分配 到 社员中
   sql="Insert MemberAddMoney(TeamID,MemberID,CSMoney,AddDate,Message,moduleid) values('" & TeamID & "','" & session("username") & "'," & Request("CsMoney") & ",'" & now & "','" & Request("sDemo") & "',1)"
   conn.execute sql

   sql="update [user] set money=" & MyMoney-Request("CsMoney") & " where username='" & session("username") & "'"
   conn.execute sql
   
   sql="update TeamData set CSMoney=CSMoney+ " & Request("CsMoney") & " where TeamID='" & TeamID & "'"
   conn.execute sql
   
   if conn.errors.count>0 then
    conn.errors.clear
    conn.rollbacktrans
    call openw("酷币注入失败,请联系迪酷客服","")
   else
    conn.commitTrans
    call openw("酷币注入成功","teamcsmoneyadd.asp")
   end if