|
Prev: Code Snippet Respository
Next: Freeing Dynamic Arrays
From: gold.herman on 12 May 2008 13:30 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?
From: Bob Barrows [MVP] on 12 May 2008 14:14 gold.herman(a)gmail.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.
|
Pages: 1 Prev: Code Snippet Respository Next: Freeing Dynamic Arrays |