Click here to Skip to main content
15,881,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
<pre lang="xml">&lt;pre lang=&quot;xml&quot;&gt;&amp;lt;pre lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;amp;lt;pre lang=&amp;amp;quot;xml&amp;amp;quot;&amp;amp;gt;&amp;amp;amp;lt;pre lang=&amp;amp;amp;quot;xml&amp;amp;amp;quot;&amp;amp;amp;gt;I need dataset data to be exported to excel.
The show stopper is : i need to transpose the data present in the dataset while presenting it in the excel.eg:
RollNo     Name       Age        Phone number
101        ABC        18         9821982121
102        PQR        17
103        XYZ        20         9819981919
104        LMN        18         9898989898
105        STU
105        STU        19

And the result should be like this.

RollNo         | 102        | 103        | 104        | 105         | 105
Name           | PQR        | XYZ        | LMN        | STU         | STU
Age            | 17         | 20         | 18         |             | 19
Phone number   |            | 9819981919 | 9898989898 |             |

The values will be dynamic, and the number of data present may be not equal in every records.
Also, there may be multiple entries of the same record(Roll number 101 repeated twice) with variable data present( )&amp;amp;amp;lt;/pre&amp;amp;amp;gt;&amp;amp;lt;/pre&amp;amp;gt;&amp;lt;/pre&amp;gt;&lt;/pre&gt;</pre>
Posted
Updated 18-Feb-13 20:24pm
v2

 
Share this answer
 
Comments
Vinay iGATE 19-Feb-13 2:25am    
Thanks for the solution. It would be more helpful, if you can provide me with the way as how to work around with the dataset data so that i can transpose the records as explained in the example in my query
Asim Mahmood 19-Feb-13 2:27am    
then please view these links

http://www.codeproject.com/Articles/32370/Import-Excel-File-to-DataSet
http://stackoverflow.com/questions/7244971/how-do-i-import-from-excel-to-a-dataset-using-microsoft-office-interop-excel
 
Share this answer
 
Comments
Vinay iGATE 19-Feb-13 2:25am    
Thanks for the solution. It would be more helpful, if you can provide me with the way as how to work around with the dataset data so that i can transpose the records as explained in the example in my query
Avik Ghosh22 19-Feb-13 2:31am    
http://msdn.microsoft.com/en-us/library/system.data.dataset.aspx
http://asp.net-informations.com/dataset/howto-asp-dataset.htm

https://www.google.co.in/#hl=en&tbo=d&sclient=psy-ab&q=how+to+use+dataset+in+asp.net+with+c%23&oq=HOW+TO+USE+dataset+IN+ASP.NET&gs_l=hp.1.1.0l2j0i7i30j0i30.65022.68890.3.71284.11.11.0.0.0.2.332.2274.0j6j3j2.11.0.les%3B..0.0...1c.1.3.psy-ab.wZSVv7oBjbs&pbx=1&bav=on.2,or.r_gc.r_pw.r_cp.r_qf.&bvm=bv.42553238,d.bmk&fp=81d14d7c7e348b8c&biw=1280&bih=629

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900