dividing a recordset up for display?

Discussion in 'ASP General' started by eyoung@ncsa.uiuc.edu, Feb 7, 2006.

  1. Guest

    I placed some code below...took out most of the unneeded html crap for
    this.
    this gives me a listing of phone charges...every other line with a
    different color for easy reading.
    What I want is this with all entries for the first "Service Number"
    then a space then everything for the next "Service Number" on and on
    until the end. Can someone tell me how to do this?

    <table>
    <tr>
    <td>Service Number</td>
    <td>Subscriber</td>
    <td>Description</td>
    <td>To Number</td>
    <td><div><b>Duration </td>
    <td>Connect Date</td>
    <td>Amount</td>
    </tr>

    <%
    Dim sBackgroundColor
    sBackgroundColor = "#ffffff"

    Do until rs.eof

    If rs("Service Number") <> "" Then
    If sBackgroundColor = "#ffffff" Then
    sBackgroundColor = "#f7f7f7"
    Else
    sBackgroundColor = "#ffffff"
    End If
    %>

    <tr bgcolor="<%=sBackgroundColor%>">
    <td><%=rs("Service Number")%></td>
    <td><%=rs("Subscriber User Name")%></td>
    <td><%=rs("Description")%></td>
    <td><%=rs("To Number")%></td>
    <td align="center"><%=rs("Duration")%></td>
    <td><%=rs("Connect Date")%></td>
    <td align="right"><%=rs("Total Charge")%></td>
    </tr>

    <% End If
    rs.MoveNext
    Loop %>
    </table>
    , Feb 7, 2006
    #1
    1. Advertising

  2. Can you reword the quoted part below? I tried, but I don't really
    understand what you're trying to do here.

    Ray at work

    <> wrote in message
    news:...

    > What I want is this with all entries for the first "Service Number"
    > then a space then everything for the next "Service Number" on and on
    > until the end.
    Ray Costanzo [MVP], Feb 7, 2006
    #2
    1. Advertising

  3. Guest

    Yes, what I have gives me every entry for 555-1111 then every entry for
    555-1112 then 555-1113 in one big table...this because my query sorted
    on "Service Number" which is the telephone number. One big recordset.

    I think I want some kind of loop to run threw this and get all the
    entries for 555-1111 then a space...then the next time threw the loop I
    get everything for the next number.
    I want to do some calculations but I won't have a problem with that if
    I get the loop
    , Feb 7, 2006
    #3
  4. Guest

    I'm not looking for someone to write script for me...I just need to
    know what to do.

    I'm guessing I need a for each loop here.
    But how do I go about that...I've looked at some web samples but they
    don't trigger anything in my super human intelligent brain :)
    , Feb 7, 2006
    #4
  5. So, you're saying that you get:

    555-1111 data data data
    555-1111 data data data
    555-1111 data data data
    555-1111 data data data
    555-1112 data data data
    555-1112 data data data
    555-1112 data data data


    But what you want is:
    555-1111 data data data
    data data data
    data data data
    data data data
    555-1112 data data data
    data data data
    data data data

    If so, here's an option: http://www.aspfaq.com/show.asp?id=2241 Be sure to
    read the whole page and not just grab the first code sample!

    Ray at work



    <> wrote in message
    news:...
    > Yes, what I have gives me every entry for 555-1111 then every entry for
    > 555-1112 then 555-1113 in one big table...this because my query sorted
    > on "Service Number" which is the telephone number. One big recordset.
    >
    > I think I want some kind of loop to run threw this and get all the
    > entries for 555-1111 then a space...then the next time threw the loop I
    > get everything for the next number.
    > I want to do some calculations but I won't have a problem with that if
    > I get the loop
    >
    Ray Costanzo [MVP], Feb 7, 2006
    #5
  6. Guest

    Yes!
    , Feb 7, 2006
    #6
  7. Guest

    Thank You
    , Feb 7, 2006
    #7
  8. ljb Guest

    "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
    message news:...
    > So, you're saying that you get:
    >
    > 555-1111 data data data
    > 555-1111 data data data
    > 555-1111 data data data
    > 555-1111 data data data
    > 555-1112 data data data
    > 555-1112 data data data
    > 555-1112 data data data
    >
    >
    > But what you want is:
    > 555-1111 data data data
    > data data data
    > data data data
    > data data data
    > 555-1112 data data data
    > data data data
    > data data data
    >
    > If so, here's an option: http://www.aspfaq.com/show.asp?id=2241 Be sure

    to
    > read the whole page and not just grab the first code sample!
    >
    > Ray at work


    My preference for doing this is to dump the entire record set into an array
    with myarray = rs.getrows. That way I don't have to keep previous row values
    in variables and check if they changed. All I do is check the current column
    and row against the value on
    if myarray(CurCol, CurRow) <> myarray(CurCol, CurRow -1) then...
    ljb, Feb 8, 2006
    #8
  9. Griff Guest

    If using classic ADO, you could also consider using a hierarchical (shaped)
    recordset
    Griff, Feb 8, 2006
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve

    Dividing a clock

    Steve, Jan 1, 2004, in forum: VHDL
    Replies:
    0
    Views:
    1,610
    Steve
    Jan 1, 2004
  2. kwaj

    Dividing Real Numbers?

    kwaj, Feb 9, 2004, in forum: VHDL
    Replies:
    2
    Views:
    1,211
  3. =?Utf-8?B?cm9kY2hhcg==?=

    dividing numbers

    =?Utf-8?B?cm9kY2hhcg==?=, Jun 28, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    459
    =?Utf-8?B?cm9kY2hhcg==?=
    Jun 28, 2005
  4. M. Akkerman
    Replies:
    5
    Views:
    381
    Jeff Schwab
    Dec 14, 2003
  5. Hung Huynh
    Replies:
    8
    Views:
    289
    Bob Barrows
    Sep 24, 2003
Loading...

Share This Page