Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 14th, 2004, 01:10 AM
Registered User
 
Join Date: Oct 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Trouble with Sum

I'm have a numeric column called "weight" in an SQL 2000 database.
I use the following code to Sum the column,

strSQL = "SELECT SUM(weight) AS totalWeight FROM eddfile " _
& "WHERE epn = " & p_epn

response.write "total weight is: " & totalWeight

The problem is that although there are records in the query, the result is not displayed. This works fine if the sql column is set to money, but I can't get it to work for a numeric column. Has anybody seen this before?

Thanks for your help.

 
Old January 14th, 2004, 08:15 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

totalWeight will be a column in the returned recordset, not a variable. I can't give you the exact syntax since you don't show us the code that executes the SQL statement, but it will be something like
response.write "total weight is: " & rsName.Fields("totalWeight").Value

I don't understand why it works with money datatype - you'll have to show us more code...





Similar Threads
Thread Thread Starter Forum Replies Last Post
Help: Running Sum (or Cumulative Sum) timdasa VB Databases Basics 1 August 22nd, 2006 03:12 PM
sum utarian Access 2 March 28th, 2005 09:42 PM
sum ibelta Access 2 February 15th, 2005 08:53 AM
need sum help! jbik BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 December 20th, 2004 05:27 PM
SUM or What bertlf Pro VB Databases 2 November 29th, 2003 02:44 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.