Created store procedure in excel?

I tried to created in c# code to export my storeprocedure in excel

SqlConnection cn = new SqlConnection(strConn); cn.Open();

SqlCommand cmd = new SqlCommand("StoreprocedureName", cn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@date",date);

SqlDataReader rdr = cmd.ExecuteReader(CommandBehavior.KeyInfo);

i don't know how i export excel.. i have use datatable to export in excel

more ▼

asked Aug 31, 2011 at 08:43 AM in Default

Chama gravatar image

92 13 16 17

Are you trying to execute a SP within excel to then populate the cells?
Aug 31, 2011 at 09:56 AM sp_lock
I need c# but if you vb.net is ok i will converted to c#
Aug 31, 2011 at 10:26 AM Chama
I deleted that comment, can you review my response above?
Aug 31, 2011 at 10:48 AM sp_lock
Yes i am tried to execute store procedure and created and export in excel.
Aug 31, 2011 at 10:52 AM Chama
(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

I not too sure about C#, but here is the VBA route that I have used before.

I did google it and I sumbled on this article. As a non-programmer I normally used the TSQL/[OPENROWSET][3]

[3]: http://msdn.microsoft.com/en-us/library/ms190312.aspx
more ▼

answered Aug 31, 2011 at 11:12 AM

sp_lock gravatar image

9.3k 25 28 31

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.



asked: Aug 31, 2011 at 08:43 AM

Seen: 1101 times

Last Updated: Aug 31, 2011 at 08:43 AM