Page 1 of 1

Load data from query

Posted: Wed 05 Aug 2009 17:50
by ioda
Hi,

I would like to know how I can load records from query. I can use Assing() procedure but I don't want to reload the fields because I have more field in VirtualTable.

this is my code but it doesn't optimized

while not (lqryGrid.Eof) do
begin
dsetGrid.Append;
for I := 0 to dsetGrid.FieldCount - 1 do
begin
if (lqryGrid.FindField(dsetGrid.Fields.FieldName) nil) then
dsetGrid.Fields.AsVariant := lqryGrid.FieldByName(dsetGrid.Fields.FieldName).AsVariant;
end;
lqryGrid.Next;
end;

Thanks in advance

Posted: Thu 06 Aug 2009 08:37
by Plash
You can use your code. The Assign method does the same except it recreates fields for VirtualTable.