Click here to Skip to main content
13,005,920 members (96,320 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

9K views
4 bookmarked
Posted 11 Dec 2009

Get data from Dataset for Exporting to Excel sheet

, 16 Dec 2009
Rate this:
Please Sign up or sign in to vote.
//THIS CODE IS WRITTEN TO FILTER THE DATASET AND GET THE REQUIRED ROWS TO DISPLAY IN THE EXCEL SHEET. DataSet tempds = new DataSet(); DataTable tempdt = new DataTable(); tempdt.Columns.Add("Column Name"); ...
//THIS CODE IS WRITTEN TO FILTER THE DATASET AND GET THE REQUIRED ROWS TO DISPLAY IN THE EXCEL SHEET. 
                    DataSet tempds = new DataSet();
                    DataTable tempdt = new DataTable();
                    tempdt.Columns.Add("Column Name");
                    tempdt.Columns.Add("Column Name");
                    tempdt.Columns.Add("Column Name");
                    tempdt.Columns.Add("Column Name");
                    tempdt.Columns.Add("Column Name");
                    tempdt.Columns.Add("Column Name");
                    DataRow dr;
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        dr = ds.Tables[0].Rows[i];
                        tempdt.ImportRow(dr);
                    }
                    tempds.Tables.Add(tempdt);

License

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

Share

About the Author

Anil Kumar.Gurram
Web Developer New Mexico Tax and Revenue department,Santa Fe,NM
United States United States
No Biography provided

You may also be interested in...

Comments and Discussions

 
-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170628.1 | Last Updated 16 Dec 2009
Article Copyright 2009 by Anil Kumar.Gurram
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid