Getting a Record Count

  • Thread starter Thread starter Jeremy Ames
  • Start date Start date
J

Jeremy Ames

I am trying to find out how many rows are returned from a select statement
that I am putting into a data reader object. What is the easiest way to do
this?
 
You'll have to iterate through the reader. The closest you can get wihtout
doing this is DataReader.HasRows() which returns true or false and only
works wiht the 1.1 framework.

otherwise...

int i = 0;

while(rdr.Read()){

///do whatever;
i++;
}
 

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