注册 登录
编程论坛 ASP技术论坛

一个 asp 修改数据库的问题~~

mu2468 发布于 2014-07-28 04:19, 576 次点击
同样是 写入和修改数据库的代码 写入 zhongzhi 数据库的都成功 但是修改 users 数据库的 数据库中amount的值 修改不了 测试了很多次了 修改不了 也没有错误提示! 求知道的朋友帮忙解答~~感激不尽!!!!
代码如下:


case "chongzhi"
    if trim(request.Form("amount"))<>"" and isnumeric(request.Form("amount")) and trim

(request.Form("alipay_orderno"))<>"" then
        payflag=false
        set rs=server.CreateObject("adodb.recordset")
        sql="select * from chongzhi where alipay_orderno='"&checkstr(request.Form

("alipay_orderno"))&"' and amount="&request.Form("amount")&" and status=3"
        rs.open sql,conn,1,3
        if not rs.eof then
            rs("uid")=LngUserID
            rs("status")=1
            payamount=rs("amount")
            payflag=true
            rs.update            
        end if
        rs.close
        
        if payflag then
             sql="select * from users where id="&LngUserID
             rs.open sql,conn,1,3
             if not rs.eof then
                rs("amount")=round(rs("amount")+payamount,2)
                rs.update
             end if
             rs.close            
         else
            sql="select * from chongzhi where alipay_orderno='"&checkstr

(request.Form("alipay_orderno"))&"'"
            rs.open sql,conn,1,3
            if rs.eof and rs.bof then   
            rs.addnew
            
            rs("uid")=LngUserID
            rs("alipay_orderno")=request.Form("alipay_orderno")
            rs("amount")=request("amount")
            rs("addtime")=now()
            rs("status")=0
            rs("typ")=2
            
            rs.update
            else
                response.Write "<script>alert('提交失

败。');location.href='chongzhi.asp'</script>"     
            end if
            rs.close
        end if        
        set rs=nothing   
        response.Write "<script>alert('提交成

功');location.href='czrecord.asp'</script>"     
    end if
2 回复
#2
hu9jj2014-07-28 07:24
会不会是数据的类型不一致?
#3
apull2014-07-28 14:17
定义个变量了保存request("amount"),跟踪一下这个变量的值合适不合适。
1