Re: Count rows in dataset WHERE ...
- From: "Marina Levit [MVP]" <someone@xxxxxxxxxx>
- Date: Mon, 21 Aug 2006 10:31:17 -0400
You can use the Select method of a particular datatable to select the rows
matching your where clause. This will return an array of rows matching the
criteria, at which point you can check the Length of that array to see how
many rows matched.
However, datatables and datasets are not in-memory databases, and you should
not attempt to use them as such. You are not going to be able to do most
things you can do in a database query, and it is certainly going to be far
less efficient then a SQL engine that has query optimization, various types
of scans, and so on.
"Assimalyst" <c_oxtoby@xxxxxxxxxxx> wrote in message
news:1156170192.426861.15500@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi,
I am attempting to do a number of count functions on a single table of
data for presentation in an ASP webpage. The functions are number
today, number this week, number this month etc. As the Database table
is large it does not make sense to query it directly a number of times.
My idea is to create a dataset containing the table "ApplicationForms".
I then want to query this and perform the various count functions.
If I were querying the database the query would be:
SELECT COUNT(DISTINCT fkiBatchNumber) AS 'YearCount'
FROM tblApplicationForms
WHERE (dtDateScanned < dtYear)
dtToday is a datetime predefined in C# code.
I have no idea how to query the dataset in an equivilent manner.
Is this the most suitable method of acheiving my requirement? If so,
any help in doing so is much appreciated.
Thanks.
.
- Follow-Ups:
- Re: Count rows in dataset WHERE ...
- From: Assimalyst
- Re: Count rows in dataset WHERE ...
- References:
- Count rows in dataset WHERE ...
- From: Assimalyst
- Count rows in dataset WHERE ...
- Prev by Date: Count rows in dataset WHERE ...
- Next by Date: Re: Count rows in dataset WHERE ...
- Previous by thread: Count rows in dataset WHERE ...
- Next by thread: Re: Count rows in dataset WHERE ...
- Index(es):
Relevant Pages
|