update and vbscript

Results 1 to 2 of 2

Thread: update and vbscript

  1. #1
    Join Date
    Dec 1969

    Default update and vbscript

    These are variables that i get from a form or my database the problem is that while the if statement works it&#039;s not working the way i want it to.I want it too only update balance as long as balance is greater than shareprice. But it updates balance even if its not greater than sharecost and then redirects me aswell.Does anyone know how to fix this. I also dont want balance to ever be negative its a money datatype in sql server does anyone know how to set it so its always greater than 0.<BR>Thnaks<BR>Leigh<BR><BR>sharecost = (pricevariable * qleigh)<BR>newbal = (balancevarialbe - sharecost)<BR><BR><BR>if cdbl(balancevarialbe) &#062; cdbl(sharecost) then<BR>set rs2=conn.execute("UPDATE sharesuser SET balance = " & newbal & " where UserName = &#039;" & Session("strLogin") & "&#039; ") <BR>else response.redirect "leigh6.html"<BR>end if

  2. #2
    Join Date
    Dec 1969

    Default RE: update and vbscript

    &#039;see what you have<BR>...<BR>Response.Write "balancevarialbe="&(balancevarialbe)&"&ltbr&gt"<BR >Response.Write "sharecost="&(sharecost)&"&ltbr&gt"<BR>strSQL = "UPDATE sharesuser SET balance = " & newbal & " where UserName = &#039;" & Session("strLogin") <BR>Response.Write "strSQL ="&(strSQL)&"&ltbr&gt"<BR>msg="Less then o"<BR>msg2="True"<BR>msg3="BuyBuy"<BR>if cdbl(balancevarialbe) &#060;= 0 then<BR>Response.Write (msg)<BR>response.redirect "leigh6.html" <BR>elseif cdbl(balancevarialbe) &#062; cdbl(sharecost) then <BR>Response.Write (msg2)<BR>set rs2=conn.execute(strSQL) <BR>else <BR>Response.Write (msg3)<BR>response.redirect "leigh6.html" <BR>end if

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts