Capturing a Compute Sum


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Capturing a Compute Sum

  1. #1
    Spidermake Guest

    Capturing a Compute Sum


    I have a stored proc:

    Procedure test_sum
    As
    SELECT PayTotal, PayAmount
    FROM escrowPay
    Where Client='DEMO CLIENT'
    ORDER BY PayTotal
    COMPUTE SUM(PayAmount) BY PayTotal
    return

    which returns the following in SQL Query Analyzer:

    PayTotal PayAmount
    Null 732.2500
    Null 192.4500

    sum
    924.7000

    I would like to return only the sum value to a textbox on an asp page

    Can anybody help me please...

  2. #2
    Michael Guest

    Re: Capturing a Compute Sum

    Spidermake,

    Make a modified copy of the stored proc so it only returns your sum. From
    the ASP page instantiate and open your DB connection and instantiate a
    recordset object. Then use the stored proc name as your argument in the open
    method of the recordset object.

    In your html use this code...

    <input type="text" name="mySumDisplay" value="<%= myRS(0)%>">

    Michael

    "Spidermake" <spidermake@hotmail.com> wrote in message
    news:3e68d10b$1@tnews.web.devx.com...
    >
    > I have a stored proc:
    >
    > Procedure test_sum
    > As
    > SELECT PayTotal, PayAmount
    > FROM escrowPay
    > Where Client='DEMO CLIENT'
    > ORDER BY PayTotal
    > COMPUTE SUM(PayAmount) BY PayTotal
    > return
    >
    > which returns the following in SQL Query Analyzer:
    >
    > PayTotal PayAmount
    > Null 732.2500
    > Null 192.4500
    >
    > sum
    > 924.7000
    >
    > I would like to return only the sum value to a textbox on an asp page
    >
    > Can anybody help me please...




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center