returning data from excel into a windows form using a stored proce

G

Guest

Hi I have a simple stored procedure shown below and am trying to use it in a
..net window application to fill a dataset. IT works out of query analyzer,
returns data from an excel file. Anyhow in the windows form the designer can
not generate the schema so I can not configure a data adapter. I could use
the Execute Nonquery but I need to return data so not quite sure if that
would be correct.


ALTER PROCEDURE emp_excel$inputfile (@name varchar(100),@sheet varchar(20)) as
DECLARE @cmd varchar(1000)

set @cmd='SELECT * FROM OPENROWSET(''Microsoft.Jet.OLEDB.4.0'',''Excel
8.0;Database='
set @cmd= @cmd + @name + ''',''select * from [' + @sheet + '$]'')'
--print @cmd
EXEC (@cmd)
Any ideas?
thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,586
Members
45,088
Latest member
JeremyMedl

Latest Threads

Top