PDA

View Full Version : Adding 2 Numbers (Again)


SteveSensei
08-18-2009, 05:11 PM
My mind must be numb as this is usually not a problem for me:

I'm trying to add 2 numbers that come from a form -
a = Request.Form("overLoan")
b = Request.Form("loanRate")
c = (a + b)

If a = 9.00 and b = 6.25, I get 9.006.25 as the answer, when it should be 15.25

Help!

ckeyrouz
08-18-2009, 05:41 PM
You are concatenation two strings because the request returns strings.

You should cast to double before you sum, like this:
CDbl


a = CDbl(Request.Form("overLoan"));
b =CDbl( Request.Form("loanRate"));

SteveSensei
08-18-2009, 07:13 PM
Many thanks!