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 .
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


Please refer the link below.
In this the function 'GenerateTransposedTable' transpose a datatable and returns the result as datatable
Dirk HaestProject managerCommented:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
toookiAuthor Commented:
Thank you.
The link in
worked for me.
I could create a DataTable with required columns in the gridview.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.