Get values from select stored procedure using a datareader

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Im needing to retrieve data from a stored procedure, Im just abit confused as to how I would do this. I need to iterate through the data with a datareader as will. Here is my stored procedure:

<pre class="prettyprint lang-sql USE GTD
GO
CREATE PROCEDURE FTPDetails
AS
BEGIN
SELECT
FTPAccount,
FTPUsername,
FTPPassword,
FTPImageFolder
FROM [DRIVER] WHERE NULLIF(FTPAccount,) IS NOT NULL AND NULLIF(FTPUsername,) IS NOT NULL AND NULLIF(FTPPassword,) IS NOT NULL AND NULLIF(FTPImageFolder,) IS NOT NULL
END[/code]
<br/>
So I need to get the FTPAccount, FTPUsername,FTPPassword and FTPImageFolder and convert them to strings as the datareader iterates through the database DRIVER table. Just dont know how to do this with a stored proc in C#. This select statement works fine if
I use on the fly in my application, but I would like to make it use a stored proc, just need to know how to get the 4 values from the stored proc as I execute it from my application<br/>
<br/>

View the full article
 
Back
Top