Addition operation in VB Script.
Hi,
I have to perform an addition operation of these variables. The variables look like this:
var1 = TRIM(CSTR(objRs.Fields
("var1").Value)) the value is 6
var2 = TRIM(CSTR(objRs.Fields
("var2").Value)) the value is 1
I want the result to be 6+1 as 7
but when I try to compute this I used
total = var1 + var2 and my total shows as 16 which is the string concatenation. How do I change this string to be an integer?
ANy pointers will be great.
Thanks
Sri
Re: Addition operation in VB Script.
var1 = cint(TRIM(CSTR(objRs.Fields
("var1").Value)))
var2 = cint(TRIM(CSTR(objRs.Fields
("var2").Value)))
Use the cint() function, then try the addition.