DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  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...




Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links