Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

DataSet transpose in ASP.NET

Posted on 2011-10-05
3
Medium Priority
?
1,057 Views
Last Modified: 2012-05-12
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 http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_27279048.html .
0
Comment
Question by:toooki
3 Comments
 
LVL 4

Assisted Solution

by:AnuTiji
AnuTiji earned 988 total points
ID: 36922668
hi

Please refer the link below.
http://www.codeproject.com/KB/database/TransposeTable.aspx
In this the function 'GenerateTransposedTable' transpose a datatable and returns the result as datatable
0
 
LVL 53

Accepted Solution

by:
Dhaest earned 992 total points
ID: 36922726
0
 

Author Comment

by:toooki
ID: 36937606
Thank you.
The link in
http://aspdotnetmatters.blogspot.com/2010/10/transpose-data-table-in-net.html
worked for me.
I could create a DataTable with required columns in the gridview.
Thanks.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month20 days, 15 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question