472,127 Members | 1,881 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

to get sum of all Quantities

hi
im new to asp. im stuck up with one problem.
im displaying "quantity" (values are extracted from the database). now i want to sum up the the quantity column & display it in a new column "total quantity".

what is the corresponding code for this in asp?
pls help.
Mar 26 '07 #1
1 1280
Hi,

just do the following:

sum=0
do while not rs.eof
sum=sum+rs("fieldname")
rs.movenext
loop

' this will give u the sum of column values.
'store this value in ur database using update query :
eg: conn.execute "update........set sum='"&sum &"'"
'or using rs.update method if u want to do so or show on ur asp page.
Mar 26 '07 #2

Post your reply

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

Similar topics

7 posts views Thread by Phil Powell | last post: by
4 posts views Thread by Westcoast Sheri | last post: by
32 posts views Thread by yukatan | last post: by
reply views Thread by leo001 | last post: by

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.