Home All Groups Group Topic Archive Search About
Author
15 Jun 2006 7:57 AM
Anuradha
Dear Experts

How can I count records in a data reader?



Thx

Anuradha

Author
15 Jun 2006 8:08 AM
CT
You need to loop through the rows using the Read method and increment a
counter I'm afraid:

While reader.Read()
    counter += 1
End While

--
Carsten Thomsen
Communities - http://community.integratedsolutions.dk
---------
Voodoo Programming: Things programmers do that they know shouldn't work but
they try anyway, and which sometimes actually work, such as recompiling
everything. (Karl Lehenbauer)
---------
Show quoteHide quote
"Anuradha" <anurad***@lankaequities.com> wrote in message
news:%23gOuGIFkGHA.412@TK2MSFTNGP05.phx.gbl...
> Dear Experts
>
> How can I count records in a data reader?
>
>
>
> Thx
>
> Anuradha
>
>
>
>
>
Author
15 Jun 2006 10:31 AM
Anuradha
What i mean is  I need to check  the table and if records found I need to
update another table. I will give a example



Select * from bktrn where EPF='" & text.text & "'



If recodes found  then

     xxxxxxxxx

end if



how can I  do this


Thx
Anuradha



Show quoteHide quote
"CT" <carstent@spammersgoawayintegrasol.dk> wrote in message
news:OtDYdLFkGHA.4276@TK2MSFTNGP03.phx.gbl...
> You need to loop through the rows using the Read method and increment a
> counter I'm afraid:
>
> While reader.Read()
>     counter += 1
> End While
>
> --
> Carsten Thomsen
> Communities - http://community.integratedsolutions.dk
> ---------
> Voodoo Programming: Things programmers do that they know shouldn't work
but
> they try anyway, and which sometimes actually work, such as recompiling
> everything. (Karl Lehenbauer)
> ---------
> "Anuradha" <anurad***@lankaequities.com> wrote in message
> news:%23gOuGIFkGHA.412@TK2MSFTNGP05.phx.gbl...
> > Dear Experts
> >
> > How can I count records in a data reader?
> >
> >
> >
> > Thx
> >
> > Anuradha
> >
> >
> >
> >
> >
>
>
Author
15 Jun 2006 11:14 AM
CT
Okay, I'm not sure where the check is done, but if you're returning the rows
in your DataReader before the check, the HasRows property will tell you if
there are any rows that matches the criteria in your SELECT statement. If
you need it done at the data source, I suggest looking at a stored procedure
and executing it. You don't mention which data source you're using.

--
Carsten Thomsen
Communities - http://community.integratedsolutions.dk
---------
Voodoo Programming: Things programmers do that they know shouldn't work but
they try anyway, and which sometimes actually work, such as recompiling
everything. (Karl Lehenbauer)
---------
Show quoteHide quote
"Anuradha" <anurad***@lankaequities.com> wrote in message
news:ujGBvcGkGHA.3780@TK2MSFTNGP03.phx.gbl...
>
>
> What i mean is  I need to check  the table and if records found I need to
> update another table. I will give a example
>
>
>
> Select * from bktrn where EPF='" & text.text & "'
>
>
>
> If recodes found  then
>
>     xxxxxxxxx
>
> end if
>
>
>
> how can I  do this
>
>
> Thx
> Anuradha
>
>
>
> "CT" <carstent@spammersgoawayintegrasol.dk> wrote in message
> news:OtDYdLFkGHA.4276@TK2MSFTNGP03.phx.gbl...
>> You need to loop through the rows using the Read method and increment a
>> counter I'm afraid:
>>
>> While reader.Read()
>>     counter += 1
>> End While
>>
>> --
>> Carsten Thomsen
>> Communities - http://community.integratedsolutions.dk
>> ---------
>> Voodoo Programming: Things programmers do that they know shouldn't work
> but
>> they try anyway, and which sometimes actually work, such as recompiling
>> everything. (Karl Lehenbauer)
>> ---------
>> "Anuradha" <anurad***@lankaequities.com> wrote in message
>> news:%23gOuGIFkGHA.412@TK2MSFTNGP05.phx.gbl...
>> > Dear Experts
>> >
>> > How can I count records in a data reader?
>> >
>> >
>> >
>> > Thx
>> >
>> > Anuradha
>> >
>> >
>> >
>> >
>> >
>>
>>
>
>