Sql Data Reader

G

Guest

I have a SQL stored procedures which evaluate the values passed in parameters
and then based on those values reads the appropriate records.

I run the stored procedure in VS 2005 Debug mode and it successfully
executes and I can see the @@ROWCOUNT has the expected number of rows.

When I actually do this with my program, the datareader is returned with no
execption, but no rows are found in the reader.

So I change my Stored procedure to not even look at the parameter values
being passed and just return rows. When I run this version of the stored
procedure, I get plenty of rows returned.

I change my stored procedure and create 2 output parameters so that I can
echo back the parameter values which were received by the program. When I
rerun the program, nothing is returned back in those parameters but a bunch
of rows are returned.

I have dumped the values of the parameters before the invoking the
DataReader method and it looks good to me. What could possibly be wrong?
 
B

bruce barker \(sqlwork.com\)

sql output parameters are not returned until after all result sets have been
processed. add this loop after you have read your rows, then you can access
the output parameters:

while (reader.NextResult()) ;

-- bruce (sqlwork.com)
 

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

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,071
Latest member
MetabolicSolutionsKeto

Latest Threads

Top