Re: Delphi 8 and ado.net

From: Xavier Pacheco (Xapware) (xavier_at_spamlessxapware.com)
Date: 03/01/04


Date: 1 Mar 2004 08:14:05 -0800

Nick Hodges (TeamB) wrote:

> What are the advantages over using Clientdatasets?

To be clear, functionally, everything you can do with a DataSet you can
do with a ClientDataSet. It's not a question of technical capability.

I personally find the the DataSet appraoch far more elegant than I do
the ClientDataSet. DataSet is part of and works well with the FCL, It
is a braindead effort to load all my Lookup Tables in one swoop, cache
them for quick retrieval in an ASP.NET application for retrieveal upon
each page request.

ie: The following can retrieve all 24 of my lookup tables and puts them
in the the Cache:

var
  sqlcn: SqlConnection;
  sqlDa: SqlDataAdapter;
  Ds: DataSet;
begin
    sqlcn := SqlConnection.Create(c_cnstr);
    sqlDA := SqlDataAdapter.Create('SELECT * from LU_1; SELECT * FROM
LU_2 ...', sqlcn);
    Ds := DataSet.Create;
    sqlDA.Fill(Ds);
    Cache['dsLookups'] := Ds;
    sqlcn.Close;
end;

Now to retrieve one of the lookup tables to populate a drop down list
on my web page is a one-liner

 SomeLookup.DataSource :=
DataSet(Cache['dsLookups']).Tables['SpecificLookup'];

At design time I would have set up the Data and Value properties for
the lookup.

It simply works natually. Can I do the same with TClientDataSet - of
course its less elegant requires more code and the result does't work
well with the databinding controls (unless I stick to borland's
controls).

I think it's good that folks discuss such differences here, I think it
would be better to illustrate code for both techniques as I feel this
would good for developers. I'm putting together yet another Delphi/.NET
web site that will contain my book examples and I just got the idea to
post the following three items for each of my examples;

The FCL Delphi way
The VCL Delphi way
The C# way

These won't be limited to by book examples so I'm interested in any
ideas.

--- x

------------------------------------
Xapware Technologies Inc.
Manage your projects with
   Active! Focus - Get More Done!
www.xapware.com



Relevant Pages

  • Re: dataset Performence Issue
    ... > - the time to retrieve a row by primary key ... > Count Load Retrieve ... > Basically the load cost per row does rise, ... > per lookup is probably better than you'll get out of a database. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: dataset Performence Issue
    ... I was thinking of was an address lookup table. ... Count Load Retrieve ... Basically the load cost per row does rise, ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: How can I lookup when match has more than one value?
    ... verbatim, and I do not think this should be that difficult. ... |I am using LOOKUP functions to retrieve info from a list. ...
    (microsoft.public.excel.worksheet.functions)
  • Re: How can I lookup when match has more than one value?
    ... verbatim, and I do not think this should be that difficult. ... |I am using LOOKUP functions to retrieve info from a list. ... Some of the lookup ...
    (microsoft.public.excel.worksheet.functions)
  • Re: In-memory "Lookup" tables
    ... >Assuming you don't have duplicate codes, ... >Description Lookup, given CATEGORY and CODE? ... The same goes for the 'Style' ComboBox. ... With the ClientDataset I have one object to mess with... ...
    (alt.comp.lang.borland-delphi)