473,396 Members | 1,967 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,396 software developers and data experts.

How to get the total number of queried records?

Hi:

I want to retrieve a set of records from the query like:

"SELECT * FROM tVisitors WHERE vTime>'1/1/2004'"

And then I will put a part of records into a DataSet by:

DataSet ds = new DataSet();

myAdapter.Fill( ds , startrecordnumber , pagesize , "tVisitors");

But I still need the total number to do something else, I don't think it's a
good idea to query again like:

Select Count(*) from tVisitor where vTime>'1/1/2004'

But any better idea?

Thanks

Q.


Nov 18 '05 #1
5 1765
Just see how many rows are in your datatable.

"Quentin Huo" <q.***@manyworlds.com> wrote in message
news:u3**************@tk2msftngp13.phx.gbl...
Hi:

I want to retrieve a set of records from the query like:

"SELECT * FROM tVisitors WHERE vTime>'1/1/2004'"

And then I will put a part of records into a DataSet by:

DataSet ds = new DataSet();

myAdapter.Fill( ds , startrecordnumber , pagesize , "tVisitors");

But I still need the total number to do something else, I don't think it's a good idea to query again like:

Select Count(*) from tVisitor where vTime>'1/1/2004'

But any better idea?

Thanks

Q.

Nov 18 '05 #2
Rows.Count

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Quentin Huo" <q.***@manyworlds.com> wrote in message
news:u3**************@tk2msftngp13.phx.gbl...
Hi:

I want to retrieve a set of records from the query like:

"SELECT * FROM tVisitors WHERE vTime>'1/1/2004'"

And then I will put a part of records into a DataSet by:

DataSet ds = new DataSet();

myAdapter.Fill( ds , startrecordnumber , pagesize , "tVisitors");

But I still need the total number to do something else, I don't think it's
a good idea to query again like:

Select Count(*) from tVisitor where vTime>'1/1/2004'

But any better idea?

Thanks

Q.

Nov 18 '05 #3
Hi, thanks

using row.count doesn't work!

if there may be100 records retrieved from the sql script, but there are 20
records, for example only the records from 10th to 29th are Filled into the
table of the DataSet by

myAdapter.Fill( ds , 10, 20, "tVisitors");

so rows.count will only return 20, but not 100.

Q.
"Marina" <so*****@nospam.com> wrote in message
news:um**************@TK2MSFTNGP11.phx.gbl...
Just see how many rows are in your datatable.

"Quentin Huo" <q.***@manyworlds.com> wrote in message
news:u3**************@tk2msftngp13.phx.gbl...
Hi:

I want to retrieve a set of records from the query like:

"SELECT * FROM tVisitors WHERE vTime>'1/1/2004'"

And then I will put a part of records into a DataSet by:

DataSet ds = new DataSet();

myAdapter.Fill( ds , startrecordnumber , pagesize , "tVisitors");

But I still need the total number to do something else, I don't think
it's

a
good idea to query again like:

Select Count(*) from tVisitor where vTime>'1/1/2004'

But any better idea?

Thanks

Q.


Nov 18 '05 #4
Then you're pretty much stuck with doing a count(*), as far as i know.

"Quentin Huo" <q.***@manyworlds.com> wrote in message
news:u1**************@TK2MSFTNGP12.phx.gbl...
Hi, thanks

using row.count doesn't work!

if there may be100 records retrieved from the sql script, but there are 20
records, for example only the records from 10th to 29th are Filled into the table of the DataSet by

myAdapter.Fill( ds , 10, 20, "tVisitors");

so rows.count will only return 20, but not 100.

Q.
"Marina" <so*****@nospam.com> wrote in message
news:um**************@TK2MSFTNGP11.phx.gbl...
Just see how many rows are in your datatable.

"Quentin Huo" <q.***@manyworlds.com> wrote in message
news:u3**************@tk2msftngp13.phx.gbl...
Hi:

I want to retrieve a set of records from the query like:

"SELECT * FROM tVisitors WHERE vTime>'1/1/2004'"

And then I will put a part of records into a DataSet by:

DataSet ds = new DataSet();

myAdapter.Fill( ds , startrecordnumber , pagesize , "tVisitors");

But I still need the total number to do something else, I don't think
it's

a
good idea to query again like:

Select Count(*) from tVisitor where vTime>'1/1/2004'

But any better idea?

Thanks

Q.



Nov 18 '05 #5
I would populate the entire dataset, then use the default veiw to filter
rows. Then you can use rows.count and get the best of both worlds.

"Quentin Huo" wrote:
Hi:

I want to retrieve a set of records from the query like:

"SELECT * FROM tVisitors WHERE vTime>'1/1/2004'"

And then I will put a part of records into a DataSet by:

DataSet ds = new DataSet();

myAdapter.Fill( ds , startrecordnumber , pagesize , "tVisitors");

But I still need the total number to do something else, I don't think it's a
good idea to query again like:

Select Count(*) from tVisitor where vTime>'1/1/2004'

But any better idea?

Thanks

Q.


Nov 18 '05 #6

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

Similar topics

0
by: Chris Hall | last post by:
The records in my database are displayed in a form as follows: %> <form action="report-ammend1.42.asp" method="post"name="form"> <table border=1> <% x = 1
2
by: Ryan | last post by:
Access97 I hope someone out there can help. This is driving me crazy. Basically, I am trying to recreate VBA's built in navigation feature (The one that allows you to move first, next,...
1
by: geronimo_me | last post by:
Hi, I have a query that has the following fields: Business: ID Number: LastName: EmpNo: Hours1: Hours2:
1
by: Ramesh | last post by:
hi, I am selecting fields from three table for manupulating data and i want to display total number of records selected. But i am always getting -1 value, eventhough 1000 of records are selected....
3
by: Amelyan | last post by:
I need to get the total number of items/records returned into GridView. If I just do myGridView.Rows.Count, then it just returns me the total number of items on the page. But if I have, 10...
2
by: msch-prv | last post by:
Hi, I have a paged gridview (Apts_grd) tied to an Access DataSource (Apts_srcGrd). How do I get the total number of data records returned by the query? The following shows only the number of...
8
by: King | last post by:
Hi I have following MS Acess query Here is the query ID Name Prgm ID Client ID Date Start Time End Time Minutes C4 Trisha TIP DEK0703 7 /7 /2006...
3
by: Otto | last post by:
Hi I'm migrating from Access til MySQL. Works fine so far - but one thing is nearly killing me: I got the count of total records in a variabel - (antalRecords) I got the count for the Field Q1...
2
by: APEJMAN | last post by:
HI I am trying to find out the total number of recoreds in a Hash Table. I am trying to write a function to calculate the total number of the recored in the Hash Table here is what I figure out,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.