This topic is locked

DB Display

7/15/2003 10:59:16 AM
ASPRunnerPro General questions
swat author

I would like to display my total value for each column. For Example:
Name Money XYZ

John $12.00 $5.00

Sue $56.00 $15.00

Han $10.00 $100.00
Total $78.00 $120.00
And every time user add new data into DB my Total should be updated by it self....
any ideas

Thank you

Sergey Kornilov admin 7/19/2003

Hi,
after you displayed table with data you need to calculate and display totals.

Set rsTotals = server.CreateObject ("ADODB.Recordset")

strSQL = "select sum(Money) as MoneyTotal, sum(XYZ) as XYZTotal from table"

rsTotals.open strSQL, dbConnection

Response.Write rsTotals("MoneyTotal")

Response.Write rsTotals("XYZTotal")

rsTotals.Close

set rsTotals = Nothing


I hope this helps.
Sergey Kornilov

cagleyleslie 11/18/2003

I'd like to total a column in my database also, and ran across this post in the forum. I can't, however, figure out where exactly to add the code provided. Can you say specifically which line of existing code it follows or precedes? Thanks!

Sergey Kornilov admin 11/19/2003

Hi,
you need to insert this code snippet after the following line:

call loopRs(rsDetails, CLng(PageSize))


I hope this helps.
Best regards,

Sergey Kornilov