473,320 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Count Rcords

Dear Experts

How can I count records in a data reader?

Thx

Anuradha

Jun 15 '06 #1
3 1437
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)
---------
"Anuradha" <an*******@lankaequities.com> wrote in message
news:%2***************@TK2MSFTNGP05.phx.gbl...
Dear Experts

How can I count records in a data reader?

Thx

Anuradha


Jun 15 '06 #2


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" <ca******@spammersgoawayintegrasol.dk> wrote in message
news:Ot**************@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" <an*******@lankaequities.com> wrote in message
news:%2***************@TK2MSFTNGP05.phx.gbl...
Dear Experts

How can I count records in a data reader?

Thx

Anuradha



Jun 15 '06 #3
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)
---------
"Anuradha" <an*******@lankaequities.com> wrote in message
news:uj**************@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" <ca******@spammersgoawayintegrasol.dk> wrote in message
news:Ot**************@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" <an*******@lankaequities.com> wrote in message
news:%2***************@TK2MSFTNGP05.phx.gbl...
> Dear Experts
>
> How can I count records in a data reader?
>
>
>
> Thx
>
> Anuradha
>
>
>
>
>



Jun 15 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

22
by: Ling Lee | last post by:
Hi all. I'm trying to write a program that: 1) Ask me what file I want to count number of lines in, and then counts the lines and writes the answear out. 2) I made the first part like this: ...
6
by: Geetha | last post by:
I searched in the Oracle documents what count (1) meant and I could not find an answer. Can some one explain what Oracle does internally when use count (1) VS count (*). Thank you very much in...
1
by: JD | last post by:
Hi guys I'm trying to write a program that counts the occurrences of HTML tags in a text file. This is what I have so far: #include <stdio.h> #include <stdlib.h> #include <string.h> ...
5
by: Eric Johannsen | last post by:
I have a simple object that inherits from CollectionBase and overrides the Count property: namespace MyTest { public class CollTest : System.Collections.CollectionBase { public override int...
4
by: Anuradha | last post by:
Dear Experts How can I count records in a data reader? Thx Anuradha
23
by: Gary Wessle | last post by:
Hi I have a vector<charwhich looks like this (a d d d a d s g e d d d d d k) I need to get the biggest count of consecutive 'd'. 5 in this example I am toying with this method but not sure if...
1
by: heckstein | last post by:
I am working in Access 2002 and trying to create a report from our company's learming management system. I am not a DBA and most of my SQL knowledge has been self taught through trial and error. I...
22
by: MP | last post by:
vb6,ado,mdb,win2k i pass the sql string to the .Execute method on the open connection to Table_Name(const) db table fwiw (the connection opened via class wrapper:) msConnString = "Data Source="...
3
by: Auddog | last post by:
I have the following query that works in mysql: select id, order_no, price, count(item_no), sum(price) from production WHERE item_no = '27714' group by item_no; When I setup my query in php,...
1
by: jlt206 | last post by:
This code <?php include("counter.php")?> on the webpage produces the count number. (function code below) I want to place the current number into a variable $MemberNo or into a FormField to be sent...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.