how to get number of rows returned by a SqlDataReader?

  • Thread starter Thread starter Juan
  • Start date Start date
J

Juan

how to get number of rows returned by a SqlDataReader without having to
scroll it?
 
Juan,
I don't think you can. If you want that type of information you'll have
to use a DataSet instead. The performance of a SqlDataReader is better, but
if you need that type of information before you loop through the results, I
think you'll have to use a DataSet.

HTH
 
Thanks, needed a confirmation...

Lateralus said:
Juan,
I don't think you can. If you want that type of information you'll have
to use a DataSet instead. The performance of a SqlDataReader is better, but
if you need that type of information before you loop through the results, I
think you'll have to use a DataSet.

HTH

--
Lateralus [MCAD]


Juan said:
how to get number of rows returned by a SqlDataReader without having to
scroll it?
 
Well, even the recordset doesn't know how many rows it
has in it until it reads the entire set, you just get a '-
1' returned until you go to the end of the dataset
forcing the entire dataset to be read.
 

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

Back
Top