How can I return a cursor from an SQL Server Procedure to c#

  • Thread starter Thread starter JB
  • Start date Start date
J

JB

I have a stored procedure being called from a C# program which is
selecting a row from a table, processing a few of the fields, then I
need to pass this back to the app.

The original program it was all done within the app, I ran the select
from the app and processed the fields from within.
Now I am trying to make it more customizable, I dont want people to be
have to modify the c# program, recompile and redeploy whenever a
change needs to be made.

The plan now is to used a stored procedure with a cursor.
So select a row into a bunch of variables, process, and then pass
these back to the calling prog.

How would I go about doing this?

I was using ExecuteReader to get the results straight from a table,
but im not sure how to go about it with an SP.
 
Hi

This is very simple, just do a SELECT FROM TABLE or #TABLE
on the end of your Stored Procedure.

Then just call the Procedure using ExecuteReader
and you will get the result back.

Best regards
Frank Uray
 

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

Back
Top