473,378 Members | 1,436 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Adding values together

Hi all i have a bit of script that i am working on that adds the numbers out of the SQL database together. I can get it to give me like 30.000.45 when i add 30.00 and 0.45 (say two prices. Really i want it to come out with 30.45.
Expand|Select|Wrap|Line Numbers
  1. Dim intNumber
  2. Dim intTotal
  3. Do While Not rsNumbers.EOF
  4. intNumber = rstesr("RSprice")
  5. intNumber = FormatNumber(intNumber,2)
  6. Response.Write intNumber
  7. intTotal = intTotal + intNumber
  8. intNumber = 0
  9. RStest.MoveNext
  10. Loop
  11.  
Its where i want to add like a shopping cart together.
Aug 15 '12 #1
1 2111
Scrap that i changed codes and instead of using "INT" i used CSng and the code below. i knew i must of not been far off

Expand|Select|Wrap|Line Numbers
  1. <%
  2. Dim CSngSum
  3. Sum = 0
  4. Do While Not RStest.EOF
  5.   CSngSum = CSngSum + CSng(RStest("RSprice"))
  6.   RStest.MoveNext
  7. Loop
  8.  
  9. Response.Write(CSngSum)
  10. %>
  11.  
Aug 15 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Sunny K | last post by:
Hi guys, I have a field in my DB called EventDate as a DateTime field, therefore it holds both the date and time together like this: '2004-10-14 08:42:57.000'. I need to add together all the...
3
by: Aaron Ackerman | last post by:
I have a bound combobox the appears on a cell within the column of my bound grid when the user clicks on a cell n(In my vb.net WinForm app). I am trying to allow the adding of an item to that bound...
2
by: Rob Kopp | last post by:
I have a query that I need a hand on. I am trying to add togther some fiends based on values of another. What I would like to add a billing total by saying more or less the following: SELECT...
15
by: crjunk | last post by:
I have 4 TextBoxes on my form that I'm trying to add together to get a grand total. Here is the code I'm using: <SCRIPT LANGUAGE="JavaScript"> <!-- Beginning of JavaScript - function...
2
by: jho | last post by:
hello, I have a pricing sheet form and have the following fields in one row: SKU DESC UNIT PRICE QTY PRICE I want to select the sku in the form and have the corresponding desc and unit...
4
by: David Plotts | last post by:
I'm a beginner with VB.net, only had one class in college on it. I can't seem to remember how to add text boxes up. I want to add the values in text boxes together, and put the value into a...
2
by: sodkgb | last post by:
This is my first time posting to the forum and welcome assistance to fix this javascript: <script language="JavaScript"> <!-- function calculate(what) { what.answer.value =0; for (var...
8
by: MGM | last post by:
This is a bit hard to explain but I'll try my best. I have 2 tables. One table has a row with the following value: 2,3 The two numbers are both ID's that are in the second table. I need to...
4
by: ranjini ns | last post by:
Hi, I have a form, and in this form, there are 2 drop down list a text box, one button (labelled "add" )and finally, a listbox. The question is, when the user clicks on the add button, how do I...
2
Thekid
by: Thekid | last post by:
I know python has math functions like 5+6 and 5*6 and 5/6 etc...but I have something like this: x=575124357 and need to add them all together: 5+7+5+1+2+4+3+5+8=40
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.