[DUG] Speed of loading a Client DataSet
John Bird
johnkbird at paradise.net.nz
Thu Dec 6 15:35:49 NZDT 2007
I want to use TClientDataSet for data that is NOT in a database.
Just reading the data from a file, eg for 15000 records, takes much less
than a second, but reading the data and inserting several fields into a
client dataset in a simple loop takes a lot longer, eg 6 seconds or more for
the same 15000 records.
The code I am using is like:
with tbData do
begin
append;
fieldbyname('FieldName1').asInteger:=Number1;
fieldbyname('FieldName2').asInteger:=Number2;
fieldbyname('FieldName3').asInteger:=Number3;
fieldbyname('Name').asString:=Name;
fieldbyname('Desc').asString:=Desc;
post;
end;
I would like to speed this up, as I have seen that reading similar data from
a Database eg with a query is much faster. Any suggestions to speed this
up?
I already have lines in such as
tbdata.DisableControls;
tbdata.EnableControls;
Before and after I start reading the data to stop screen updates....
John
More information about the Delphi
mailing list