Reputation: 856
How can one read sql server data and write it to excel file in C#? Do I need to use an external .Net library, or is it just OK using Visual Studio itself?
Any example and link will be well appreciated..
Note: Please send examples for Winforms, not asp.net
Upvotes: 0
Views: 15535
Reputation: 2683
I would use some kind of OR-Mapper to read data from SQL such as
For writing data to Excel you could bind hardly to any Excel Version by referencing the Excel Assemblies. The cleaner and more beautiful way is to use Open XML SDK for Office http://www.microsoft.com/download/en/details.aspx?id=5124
Upvotes: 2
Reputation: 696
You could find helpful information how to achieve that goal in the following blog posts: 1. http://msmvps.com/blogs/deborahk/archive/2009/07/23/writing-data-from-a-datatable-to-excel.aspx 2. http://tim.mackey.ie/HowtoExportADatasetToExcelCAspnet.aspx
Upvotes: 1
Reputation: 22323
see:
http://www.c-sharpcorner.com/UploadFile/DipalChoksi/exportxl_asp2_dc11032006003657AM/exportxl_asp2_dc.aspx
http://geekswithblogs.net/VROD/archive/2008/04/20/121433.aspx
Upvotes: 1
Reputation: 1450
Follow the below article, this even provide the facility to export the data into many formats.
Export data to Excel and other formats using C#
Upvotes: 1