Re: Count rows in dataset WHERE ...

Tech-Archive recommends: Fix windows errors by optimizing your registry



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.



.



Relevant Pages

  • Re: form - request question
    ... Name your desired variables, loop through the $_POST/$_GET array, ... these names are used to build the query. ... column names in de database. ... you''d change the location or surrounding code of the script it could break. ...
    (alt.php)
  • Re: Can someone tell me what is wrong with this?
    ... > in checkboxes that if selected, will be then be used to select specific ... you're looping through each item in an array. ... If it is the result of a database ... query, is it perhaps an array of arrayrefs? ...
    (comp.lang.perl.misc)
  • Re: Algorithm isnt working
    ... > supposed to connect to a database and perform a query to get all the ... What makes you so certain that the order in the $files array corresponds ... For each loop you should check for its presence in the ...
    (comp.lang.php)
  • Re: Multiple similar dropdowns -> 1 query
    ... >Hmm, could you maybe explain a little bit more? ... >times from 1 query ... ... $array is the array from the database and $sel is the selection you are ...
    (comp.lang.php)
  • Re: DBMS and lisp, etc.
    ... Naively implemented with SQL, again for 10 ... (1 query for the initial orders, 1 query for each order for its ... soon as you upgrade to the SQL database. ... (eq (order-customer orderA) ...
    (comp.lang.lisp)