Click here to Skip to main content
Click here to Skip to main content

Tagged as

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

Comments and Discussions

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