Hi all,

I am trying to figure out how to retrieve the number of
records resulting from a select. I tried executereader
but the object does not contain the number iof records retrieved. Any
suggestions?

Thanks,

Carlos

Re: number of recs from select by Jim

Jim
Wed Jun 07 15:41:05 CDT 2006

use executescalar with "select count(*) from yourtable"

or

loop through all of the records in the reader and increment a counter.


"Carlos" <ch_sanin@yahoo.com> wrote in message
news:eSGt1ymiGHA.4080@TK2MSFTNGP04.phx.gbl...
> Hi all,
>
> I am trying to figure out how to retrieve the number of
> records resulting from a select. I tried executereader
> but the object does not contain the number iof records retrieved. Any
> suggestions?
>
> Thanks,
>
> Carlos
>



Re: number of recs from select by Paul

Paul
Thu Jun 08 14:09:20 CDT 2006

On Wed, 7 Jun 2006 15:58:11 -0400, "Carlos" <ch_sanin@yahoo.com> wrote:

¤ Hi all,
¤
¤ I am trying to figure out how to retrieve the number of
¤ records resulting from a select. I tried executereader
¤ but the object does not contain the number iof records retrieved. Any
¤ suggestions?

If you're pulling the rows into DataSet you can check the Count property of the Rows collection of
the DataTable.


Paul
~~~~
Microsoft MVP (Visual Basic)