473,320 Members | 1,744 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.

Data Reader

Dear Experts

How can I count how many records load to the Data Reader

And if I run while.dataReader.read() loop. will it automatically move to
the next record and loop pls help me

Best regards,

Anuradha
Jun 9 '06 #1
2 1221
Anuradha,

You can do it in advance with a
"Select count from table ...........where..........."
integer Count = Cmd.ExecuteScalar(sqlString,conn)

(Be aware that while reading somebody else can remove a record)
I hope this helps,
Cor
"Anuradha" <an*******@lankaequities.com> schreef in bericht
news:%2****************@TK2MSFTNGP04.phx.gbl...
Dear Experts

How can I count how many records load to the Data Reader

And if I run while.dataReader.read() loop. will it automatically move to
the next record and loop pls help me

Best regards,

Anuradha

Jun 9 '06 #2
Hello Anuradha,

The DataReader is analogous to a sql forward only cursor. So using strictly
a DataReader you can not determine the number of records fetched.
You can however count each record as you process it.. in which case you will
have a running total during processing and a grand total after processing.
If you need a grand total before processing (or during) then I would point
you towards a DataTable.

-Boo
Dear Experts

How can I count how many records load to the Data Reader

And if I run while.dataReader.read() loop. will it automatically move
to the next record and loop pls help me

Best regards,

Anuradha

Jun 9 '06 #3

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

Similar topics

9
by: Mike L | last post by:
I tried a sample of code in MSDN magazine, but now I'm stuck. What code has the best performance to populate a Data Grid with a SP? Below is the code I have, which might be completing the wrong...
2
by: Robert Smith jr. | last post by:
Hello, Please pardon my newbie question ... I am building an ASP.NET page that displays a recordset with a Delete statement enabled (this all works fine). I want to Insert the current row...
4
by: Ram | last post by:
I am using ADO.Net data reader to retrieve data from main frame. I am getting timestamp which is 26 (yyyy-mm-dd hh- mm-ss.123456) bytes as sqltimestamp data type. I am using data reader to...
2
by: Joe | last post by:
Anyone can suggest the best method of reading XML and adding data to ListView? Here is the xml data structure:: <xml> <site> <url>http://www.yahoo.com</url> <lastupdate></lastupdate>...
0
by: Crazy Cat | last post by:
In the following code I retrieve data from a stored procedure that returns multiple resultsets (the results of the stored procedure have been stored in a datareader called reader). On each...
6
by: Jim Heavey | last post by:
I am new to SqlServer, have been using Oracle in a prior life. I have written a very simple stored procedure in SQL Server and it (the query) looks like the following... Select AD_ID,...
1
by: weird0 | last post by:
I have created a GridView and dynamically added data to it by creating a DataTable(as advised) and bound it with a reader. Then, assigned the DataSource of GridView to DataTable. But even that aint...
0
by: bill | last post by:
Can someone please show me what to do with this to show the data in a dataGrid for example? I'm not really sure what to do with it. I'm used to Vb6. Dim Con = New...
1
by: =?Utf-8?B?SkI=?= | last post by:
Hello My pgm1 (User Interface Level) passes an empty ArrayList to pgm2 (Business Logic Level). pgm2 then calls pgm3 (Data Access Level) to populate the ArrayList. Question1: When pgm2 gets...
1
by: dotnetnovice | last post by:
Hi everybody... I want to show data in the data gridview placed in my form after getting data from my data access layer class through a class... Here is my code in the data access layer class....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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...
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
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.