Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Export dataset into excel sheet in C#

Author  Topic 

Dhanalakshmi
Starting Member

12 Posts

Posted - 2011-10-20 : 04:22:45
Hi All,
How to export data set into a new excel sheet in C#?

Can you please help me?


Thanks,
Dhanalakshmi.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-20 : 04:26:56
you mean export data stored in sql table to excel?
if yes, you dont need c#
you can use OPENROWSET or SSIS export import wizard

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Dhanalakshmi
Starting Member

12 Posts

Posted - 2011-10-20 : 04:38:09
No, I need to export data set(sql query result)into excel through C# application?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-20 : 04:40:45
even then you can use ssis export/import wizard. no need of using c# unless you've any other reason

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-10-21 : 03:38:35
If you want to do it in C# see code examples in C# site. You can however do it via sql using openrowset. See this for more details http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=49926


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-21 : 04:40:14
you need to make sure you've enable ad-hoc distributed queries if you've to use opnrowset

http://www.kodyaz.com/articles/enable-Ad-Hoc-Distributed-Queries.aspx

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

charlesbecon
Starting Member

3 Posts

Posted - 2016-11-03 : 01:45:39
Check this one....[url=http://csharp.net-informations.com/excel/csharp-excel-export.htm]C# Excel Export[/url]

Charles
Go to Top of Page
   

- Advertisement -