asp datatable?

G

gold.herman

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

Bob Barrows [MVP]

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,079
Messages
2,570,574
Members
47,207
Latest member
HelenaCani

Latest Threads

Top