|
 |
asp_web_howto thread: Totalling up a coloumn in ASP
Message #1 by "Grant, Maughtlyn V" <GrantMV@s...> on Wed, 5 Mar 2003 07:04:35 -0500
|
|
Dear All
I am tring to output the total of a column on an asp page. The stored
procedure is in SQL 7, a sample is as follows:
ASP page output
Name Amount
Sue 11.00
Mary 10.00
Cannot out this from SQL
Compute Sum(Amount)
How can I output the value of the sql compute statement on my asp page? Can
anyone help?
Maughtlyn Grant
Message #2 by "Ken Schaefer" <ken@a...> on Thu, 6 Mar 2003 12:08:58 +1100
|
|
Three options:
a) you can execute a separate query in SQL Server and UNION the results to
your existing query
b) you can execute a separate query in SQL Server and return the result as
an OUTPUT parameter
c) (probably easiest), as you loop through your recordset, increment a
counter variable with the value of the current record. Response.Write() the
total when you've finished looping.
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Grant, Maughtlyn V" <GrantMV@s...>
Subject: [asp_web_howto] Totalling up a coloumn in ASP
: I am tring to output the total of a column on an asp page. The stored
: procedure is in SQL 7, a sample is as follows:
:
: ASP page output
:
: Name Amount
: Sue 11.00
: Mary 10.00
:
: Cannot out this from SQL
: Compute Sum(Amount)
:
: How can I output the value of the sql compute statement on my asp page?
Can
: anyone help?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message #3 by "Grant, Maughtlyn V" <GrantMV@s...> on Thu, 6 Mar 2003 03:32:39 -0500
|
|
Thank you so much Ken, once again you've saved the day for me. Much
appreciated.
Maughtlyn Grant
-----Original Message-----
From: Ken Schaefer [mailto:ken@a...]
Sent: Thursday, March 06, 2003 1:14 AM
To: ASP Web HowTo
Subject: [asp_web_howto] Re: Totalling up a coloumn in ASP
Three options:
a) you can execute a separate query in SQL Server and UNION the results to
your existing query
b) you can execute a separate query in SQL Server and return the result as
an OUTPUT parameter
c) (probably easiest), as you loop through your recordset, increment a
counter variable with the value of the current record. Response.Write() the
total when you've finished looping.
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Grant, Maughtlyn V" <GrantMV@s...>
Subject: [asp_web_howto] Totalling up a coloumn in ASP
: I am tring to output the total of a column on an asp page. The stored
: procedure is in SQL 7, a sample is as follows:
:
: ASP page output
:
: Name Amount
: Sue 11.00
: Mary 10.00
:
: Cannot out this from SQL
: Compute Sum(Amount)
:
: How can I output the value of the sql compute statement on my asp page?
Can
: anyone help?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
 |