|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
sqldatareader.read()Wondering why the following if statement does not run.
// obviously the name of my datareader is not sqldatareader if(sqldatareader.read()) { //code } For some reason when my code hits the following if statement it is reading "(!sqldatareader.read()). There are no other sqldatareaders open. When querying the storedprocedure in query analyzer records are returned. The connection is open and everything goes fine while reading the name of the stored proc, etc.. What other reasons might the datareader.read() not be executing? Try checking the sqldatareader's HasRows property...
Show quote "Pat Brown" <PatBr***@discussions.microsoft.com> wrote in message news:4AE3F85D-6FD6-4F80-8216-91E2FEB12B12@microsoft.com... > Wondering why the following if statement does not run. > > // obviously the name of my datareader is not sqldatareader > if(sqldatareader.read()) > { > //code > } > > For some reason when my code hits the following if statement it is reading > "(!sqldatareader.read()). > There are no other sqldatareaders open. > When querying the storedprocedure in query analyzer records are returned. > The connection is open and everything goes fine while reading the name of > the stored proc, etc.. > What other reasons might the datareader.read() not be executing? > You might also need to check for multiple resultsets from your query (i.e.
what does NextResult() return?). -- Show quote~Alazel Alazel Acheson Software Developer Microsoft SQL Server This posting is provided "AS IS" with no warranties, and confers no rights. "Greg Burns" <bluebunny@newsgroups.nospam> wrote in message news:eBrCW9v5FHA.3188@TK2MSFTNGP15.phx.gbl... > Try checking the sqldatareader's HasRows property... > > "Pat Brown" <PatBr***@discussions.microsoft.com> wrote in message > news:4AE3F85D-6FD6-4F80-8216-91E2FEB12B12@microsoft.com... >> Wondering why the following if statement does not run. >> >> // obviously the name of my datareader is not sqldatareader >> if(sqldatareader.read()) >> { >> //code >> } >> >> For some reason when my code hits the following if statement it is >> reading >> "(!sqldatareader.read()). >> There are no other sqldatareaders open. >> When querying the storedprocedure in query analyzer records are returned. >> The connection is open and everything goes fine while reading the name of >> the stored proc, etc.. >> What other reasons might the datareader.read() not be executing? >> > > |
|||||||||||||||||||||||