
Having trouble adding numbers
I'm trying to run a report that adds a number to a field in the database (SQL). I'm adding two simple numbers. Like .019 and 3.234.<BR><BR>But I'm getting these long numbers with like 10 numbers after the decimal point.<BR><BR>I'm using a REAL data type in the dB. I've tried others. To test it I'm writing out the sums. And they're all long numbers. There should only be 3 places after the decimal point<BR><BR>Why is it doing this? please help.

RE: Having trouble adding numbers

RE: Having trouble adding numbers
Here's the line where I'm adding the numbers. They should be numbers.<BR><BR>rs("field1") = (rs("field1")+variable)<BR><BR>Thanks

RE: Having trouble adding numbers
What is it doing? Is it concatenating it?

RE: Having trouble adding numbers
No, it doesn't seems to be. I'm getting number like: 3.23498273492873497. What's really wierd is the numbers are like that when I write them out to look at them on the webpage. But they look right in the database. But then when I try and sum them, I get the wierd numbers again. It seems like a wierd datatype problem, but it doesn't make sense

RE: Having trouble adding numbers
Have you tried to Response.Write each of the values, at each step?<BR><BR>(Before addition, after addition, etc.)

RE: Having trouble adding numbers
yeah try using this:<BR><BR>field1 = Clng(field2) + Clng(field1)<BR><BR>or trying switching them to dim instead of real

RE: Having trouble adding numbers
Yes. On the page it's writing out these really long numbers. They should be like .422, but they're comming out something like 4.39999998807907E02. <BR><BR>What should I do to add them correctly? should I use cInt, or cldb, or formatNumber or something like that to add them properly?<BR><BR>Thanks again,

RE: Having trouble adding numbers
thanks, I'll try it.

RE: Having trouble adding numbers
I tried the 'Clng' and they came back as whole numbers or 0's
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

