|
-
Jun 22nd, 2003, 10:13 AM
#1
Thread Starter
Junior Member
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
-
Jun 22nd, 2003, 12:35 PM
#2
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.
-
Jun 22nd, 2003, 10:38 PM
#3
Thread Starter
Junior Member
Thanks!
Thanks for your help. Cint() did the trick!
-
Jun 22nd, 2003, 11:53 PM
#4
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|