SQLDataReader not working

G

Guest

Hi,

I am trying to read data from a stored procedure(SP) using the
SQLDataReader. Inside SP, i populate a temp table (created using SQL Table
variable) with some records based upon some logic. Last statement in the SP,
selects few records from the temp table.

The SQLDataReader on the client side returns zero records sometimes(which is
not expected) and 5 records sometimes(which is expected) and this happens
alternatively. 5,0,5,0...

what is it that i am missing.

Thanks,
Yash
 
M

Marina Levit [MVP]

This sounds like a bug in your code or stored procedure, causing it to give
these results. Since your provided just vague details, that's about all I
can say.
 
W

W.G. Ryan [MVP]

If you have more than one statement, check the NextResult property. The
problem may be that the first query isn't returning rows, but you have
multiple resultsets. That's my first guess. Check NextResult (Use a While
loop) which may help you. If not, just let me know and maybe you can post
the code
 

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

Top