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

avatar image

92 14 16 19

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

more ▼

answered Aug 31, 2011 at 11:12 AM

avatar image

10.9k 27 37 37

(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.

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: 1277 times

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

Copyright 2018 Redgate Software. Privacy Policy