How to get the total number of queried records?

Q

Quentin Huo

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.
 
Q

Quentin Huo

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.
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top