Load data from query

Load data from query

Postby ioda » Wed 05 Aug 2009 17:50

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[I].FieldName) <> nil) then
dsetGrid.Fields[I].AsVariant := lqryGrid.FieldByName(dsetGrid.Fields[I].FieldName).AsVariant;
end;
lqryGrid.Next;
end;

Thanks in advance
ioda
 
Posts: 12
Joined: Fri 08 Feb 2008 15:11

Postby Plash » Thu 06 Aug 2009 08:37

You can use your code. The Assign method does the same except it recreates fields for VirtualTable.
Plash
Devart Team
 
Posts: 2844
Joined: Wed 10 May 2006 07:09


Return to VirtualDAC