Printing data with ASP

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • David

    Printing data with ASP

    Hi,

    I have an SQL statement which outputs the following data:

    A: RS("SelectorNam e")
    B: RS("SelectorQty ")
    C: RS("ShipQty")

    For each record printed, I need to calculate (B * C), this is easy
    enough.
    I set up a variable as follows: TMW = RS("SelectorQty ") * RS("ShipQty")

    The page currently prints as follows:-

    96 50
    96 100
    96 100
    96 100

    (96 = SelectorName, 50 & 100 = TMW)
    <I want to print here : 96 = 350

    97 12
    97 18
    97 53
    97 67

    <I want to print here : 97 = 150

    ..... and so on.

    Can anyone help me do this ? or explain how to do this.

    ****** >>>>Eventuall y, I just need a page that prints out:
    i.e. running through each Selector and printing the sum.

    96 = 350
    97 = 150

    and so on ....... I just though I ought to explain in stages.

  • Bob Barrows [MVP]

    #2
    Re: Printing data with ASP

    David wrote:
    Hi,
    >
    I have an SQL statement which outputs the following data:
    >
    A: RS("SelectorNam e")
    B: RS("SelectorQty ")
    C: RS("ShipQty")
    >
    For each record printed, I need to calculate (B * C), this is easy
    enough.
    I set up a variable as follows: TMW = RS("SelectorQty ") *
    RS("ShipQty")

    I don't understand why you would not do this in the query?
    >
    The page currently prints as follows:-
    >
    96 50
    96 100
    96 100
    96 100
    >
    (96 = SelectorName, 50 & 100 = TMW)
    <I want to print here : 96 = 350
    Again, this can be done in the query.

    SELECT SelectorName, SUM(SelectorQty * ShipQty) AS total
    FROM yourtable
    GROUP BY SelectorName



    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.


    Comment

    • Ray Costanzo [MVP]

      #3
      Re: Printing data with ASP

      See your other post. Essentially the same question.

      Ray at work

      "David" <davidgordon@sc ene-double.co.ukwro te in message
      news:1159189282 .543976.324890@ i42g2000cwa.goo glegroups.com.. .
      Hi,
      >
      I have an SQL statement which outputs the following data:
      >
      A: RS("SelectorNam e")
      B: RS("SelectorQty ")
      C: RS("ShipQty")
      >
      For each record printed, I need to calculate (B * C), this is easy
      enough.
      I set up a variable as follows: TMW = RS("SelectorQty ") * RS("ShipQty")
      >
      The page currently prints as follows:-
      >
      96 50
      96 100
      96 100
      96 100
      >
      (96 = SelectorName, 50 & 100 = TMW)
      <I want to print here : 96 = 350
      >
      97 12
      97 18
      97 53
      97 67
      >
      <I want to print here : 97 = 150
      >
      .... and so on.
      >
      Can anyone help me do this ? or explain how to do this.
      >
      ****** >>>>Eventuall y, I just need a page that prints out:
      i.e. running through each Selector and printing the sum.
      >
      96 = 350
      97 = 150
      >
      and so on ....... I just though I ought to explain in stages.
      >

      Comment

      Working...