Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Update and vbscript


Message #1 by lodris@m... on Sun, 27 May 2001 11:04:13
These are variables that i get from a form or my database the problem is 

that while the if statement works it'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. 

Thnaks 

Leigh 



sharecost = (pricevariable * qleigh) 

newbal = (balancevarialbe - sharecost) 





if cdbl(balancevarialbe) > cdbl(sharecost) then 

set rs2=conn.execute("UPDATE sharesuser SET balance = " & newbal & " where 

UserName = '" & Session("strLogin") & "' ") 

else response.redirect "leigh6.html" 

end if 

  Return to Index