Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SQL on a TClientDataSet

2 views
Skip to first unread message

Nicola

unread,
Jul 27, 2000, 3:00:00 AM7/27/00
to
I must do a series of SQL on a dataset of records gained via TClientDataSet.
How can i use a SQL on all the record for retrieve how many users have ID >
12 o something else ...

--
nr

Nicola

unread,
Jul 27, 2000, 3:00:00 AM7/27/00
to
My idea is: i have already all the records and i must do an action on they
to retrieve some of them.
Why i'd must reuse a connection to reload a lot of record when i have all of
it ?

I'm excusing for my bad english


"Nicola" <nico...@libero.it> ha scritto nel messaggio
news:398051b3$1_2@dnews...

Natalie Boodram

unread,
Jul 27, 2000, 3:00:00 AM7/27/00
to
You cannot do direct SQL against a client dataset, but you can filter them
using some pretty flexible expressions. Take a look at the Filter property
in the help.

Natalie


Nicola <nico...@libero.it> wrote in message news:398051b3$1_2@dnews...

Norberto Hideaki Enomoto

unread,
Jul 28, 2000, 3:00:00 AM7/28/00
to
You can use the commandtext property of class TClientDataSet. At the Server
side you must have
an ProviderDataSet connected with a Query. In the ProviderDataSet you must
to set the proprerty poAllowCommandText = True. Your ClientDataSet must have
to connect with a ProviderDataSet.

Example
with ClientDataSet1 do
begin
CommandText := 'SELECT CUSTNO FROM CUSTOMER WHERE CUSTNO >= 200';
Open;
end

Norberto Hideaki Enomoto

Nicola <nico...@libero.it> escreveu nas notícias de
mensagem:398051b3$1_2@dnews...

Natalie Boodram

unread,
Jul 28, 2000, 3:00:00 AM7/28/00
to
Note that this method does return to your application server and database
server to retrieve results.
Natalie


Norberto Hideaki Enomoto <norbert...@onetoone.com.br> wrote in message
news:39819169_1@dnews...

Nicola

unread,
Jul 31, 2000, 3:00:00 AM7/31/00
to
If i want to know how many records there are tha have CUSTNO >= 200 ?


"Norberto Hideaki Enomoto" <norbert...@onetoone.com.br> ha scritto nel
messaggio news:39819169_1@dnews...

Natalie Boodram

unread,
Jul 31, 2000, 3:00:00 AM7/31/00
to
If you already have your client dataset populated, you can do the following:
cds.Filter := 'CUSTNO >= 200';
cds.Filtered := True;
iNumRecords := cds.RecordCount;

If your client dataset has not yet retrieved any data:
cds.CommandText := 'select count(*) from MY_TABLE where CUSTNO >= 200';
cds.Open; // ProviderName and RemoteServer must be set, and the Provider
must have poAllowCommandText option set


Nicola <nico...@libero.it> wrote in message news:39852754_2@dnews...

0 new messages