|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
Adding together DB Fields
I am requesting cost information from three databses and trying to add them together using asp but I am having problems.
totalCost = data01("cost") + data02("cost") + data03("cost") when I try to display totalCost <% =totalCost %> it comes out as 5.005.005.00 just joining them together not adding then together I tried formating the data using formatNumber() but that didn't work either. If anyone could point out to me what I'm doing wrong it would be most appriciated. Thanks. |
|
#2
|
|||
|
|||
|
how are they stored in the database? the Value property of the field is a Variant so you should always make sure to convert when dealing with numeric values
Code:
totalCost = CDbl(data01("cost")) + CDbl(data02("cost")) + CDbl(data03("cost"))
__________________
Programmer's Corner |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Adding together DB Fields |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|