x

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

cn.close();

more ▼

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

avatar image

Chama
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

sp_lock
10.5k 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

By RSS:

Answers

Answers and Comments

SQL Server Central

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

Topics:

x457
x140

asked: Aug 31, 2011 at 08:43 AM

Seen: 1271 times

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

Copyright 2016 Redgate Software. Privacy Policy