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 November 16th, 2005, 12:14 PM
Registered User
 
Join Date: Nov 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default store 2 records for future calculations

Hello, wondering if anyone can help me.

I have 2 queries within an asp page that i wish to pull one record from each, and then be able to add the two records together to create a total.

All the calculations on the page will remain as they are but i want to therefore be able to show a calculation similar to: rsItems10("sum") + rsItems11("sum") = ?

Does anyone know how to do this?


Code:-
<%
Dim rsItems10
strSQL = "SELECT * FROM managingChangeQry"
Set rsItems10 = Server.CreateObject("ADODB.Recordset")
rsItems10.Filter = "sellerid = " & Session("PersonID")
rsItems10.Open strSQL, objConn
If Not rsItems10.EOF Then
      If Session("PersonID") <> "" Then
         Response.Write "<BR>query 1"
      End If

Do While Not rsItems10.EOF
    If Session("PersonID") <> "" Then
    Response.Write "<br>" & "(" & (FormatNumber((rsItems10
    ("sum") / 28) * 100)) & "%" & ")"
    Else
    Response.Write "<br>" & "(" & (FormatNumber((rsItems10("sum") /
    28) * 100)) & "%" & ")"
    End If

    rsItems10.MoveNext
    Loop
    rsItems10.close
    Set rsItems10 = Nothing
  Else
    Response.Write "<CENTER>Questions not completed</CENTER>"
  End If


  Dim rsItems11
  strSQL = "SELECT * FROM teamworkingQry"
  Set rsItems11 = Server.CreateObject("ADODB.Recordset")
  rsItems11.Filter = "sellerid = " & Session("PersonID")
  rsItems11.Open strSQL, objConn
  If Not rsItems11.EOF Then
     If Session("PersonID") <> "" Then
     Response.Write "<BR>query 2"
   End If

   Do While Not rsItems11.EOF
      If Session("PersonID") <> "" Then
      Response.Write "<br>" & "(" & (FormatNumber((rsItems11
      ("sum") / 36) * 100)) & "%" & ")"

      Else
        Response.Write "<br>" & "(" & (FormatNumber((rsItems11
        ("sum") / 36) * 100)) & "%" & ")"
      End If


      rsItems11.MoveNext
    Loop
    rsItems11.close
    Set rsItems11 = Nothing
  Else
    Response.Write "<CENTER>Questions not completed</CENTER>"
  End If
  %>







Similar Threads
Thread Thread Starter Forum Replies Last Post
future of XML bcogney XML 1 April 19th, 2006 04:48 AM
store 2 records for future calculations gavmc Classic ASP Databases 0 November 16th, 2005 12:23 PM
Change id in address bar and see future records karib Beginning PHP 0 September 16th, 2005 02:46 AM
calculations between records plenarts Access 5 December 30th, 2004 08:05 AM
ASP future alitoday Classic ASP Databases 5 August 26th, 2004 10:43 PM





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