|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
SQLDataReader not workingHi,
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 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. Show quote "Yash" <Y***@discussions.microsoft.com> wrote in message news:EA04B741-2065-4F08-8070-E0F7415DAF4F@microsoft.com... > 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 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 Show quote "Yash" <Y***@discussions.microsoft.com> wrote in message news:EA04B741-2065-4F08-8070-E0F7415DAF4F@microsoft.com... > 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 |
|||||||||||||||||||||||