Avatar of toooki
toooki

asked on 

DataSet transpose in ASP.NET

In my ASP.NET code (C# Visual Studio 2008) I am have obtained this dataset by querying the Oracle database table:

The dataset looks like this:
However the number of columns (here it is 4) is not constant in the obtained dataset.
f1             f2                            f3                    f4
--------------------------------------------------------
AAA              Lead_of_AAA      10/2/2011      4
AAA              Lead_of_AAA      10/9/2011      5
AAA              Lead_of_AAA      10/16/2011      8
BBB      Lead_of_BBB      10/2/2011      7
BBB      Lead_of_BBB      10/9/2011      0
BBB      Lead_of_BBB      10/16/2011      5
CCC      Lead_of_CCC      10/2/2011      3
CCC      Lead_of_CCC      10/9/2011      1
CCC      Lead_of_CCC      10/16/2011      8

How could I transpose this data set to obtain a dataset like:

f1       f2                        10/2/2011    10/9/2011  10/16/2011
--------------------------------------------------------------------------
AAA   Lead_of_AAA    4                     5                8
BBB   Lead_of_BBB  7                      0               5
CC    Lead_of_CCC  3                      1               8

Here I could assume f3 contents are string variable (not dates).
I am trying to do exactly opposite (converse) of what was done in https://www.experts-exchange.com/questions/27279048/DataSet-transpose-in-ASP-NET.html .
ASP.NET.NET ProgrammingC#

Avatar of undefined
Last Comment
toooki

8/22/2022 - Mon