asp datatable?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • gold.herman@gmail.com

    asp datatable?

    Hi i am using classical asp and have a problem that I hope someone can
    provide an elegant suggestion.

    I have a recordset return rows looking like

    Name,Stage,Amt
    joe,s1,20
    joe,s3,30
    sam,s2,10
    sam,s3,20
    sam,s4,30

    and I like to constuct an html table looking like:

    name s1 s2 s3 s4 s5
    joe 20 0 30 0 0
    sam 0 10 20 30 0

    The stage is fixed s1 to s5 but not all names have all stages. Any
    hints how I can convert a recordset to this kind of table?
  • Bob Barrows [MVP]

    #2
    Re: asp datatable?

    gold.herman@gma il.com wrote:
    Hi i am using classical asp and have a problem that I hope someone can
    provide an elegant suggestion.
    >
    I have a recordset return rows looking like
    >
    Name,Stage,Amt
    joe,s1,20
    joe,s3,30
    sam,s2,10
    sam,s3,20
    sam,s4,30
    >
    and I like to constuct an html table looking like:
    >
    name s1 s2 s3 s4 s5
    joe 20 0 30 0 0
    sam 0 10 20 30 0
    >
    The stage is fixed s1 to s5 but not all names have all stages. Any
    hints how I can convert a recordset to this kind of table?
    There's nothing magical to make it happen. Basically, you loop through
    the recordset and assemble the string containing the html to display the
    data in the way you want.

    Actually, depending on what database you are using, you could construct
    a crosstab query to return the data in the form you desire. Without
    knowing what database you are using I cannot provide specifics.

    --
    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

    Working...