x
login about faq Site discussion (meta-askssc)

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 '11 at 08:43 AM in Default

Chama gravatar image

Chama
91 5 9 13

Are you trying to execute a SP within excel to then populate the cells?

Aug 31 '11 at 09:56 AM sp_lock

I need c# but if you vb.net is ok i will converted to c#

Aug 31 '11 at 10:26 AM Chama

I deleted that comment, can you review my response above?

Aug 31 '11 at 10:48 AM sp_lock

Yes i am tried to execute store procedure and created and export in excel.

Aug 31 '11 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 '11 at 11:12 AM

sp_lock gravatar image

sp_lock
8.1k 20 26 29

(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



Facebook logo Follow Ask SSC on Facebook
Find Ask SSC on Google+
linkedin logo Find us on LinkedIn

Topics:

x340
x98
x4

asked: Aug 31 '11 at 08:43 AM

Seen: 640 times

Last Updated: Aug 31 '11 at 08:43 AM

Copyright © 2002-2012 Simple Talk Publishing. All Rights Reserved. If you have any queries, please contact the site administrators.
Ask SQL Server Central is a community service provided by Red Gate.