So ist es meiner Meinung nach etwas einfacher.
Delphi-Quellcode:
var
current: Integer;
Filterstatus: Boolean;
fld: TField;
linelist: TStringList;
datalist: TStringList;
begin
current := cds1.RecNo;
FilterStatus := cds1.Filtered;
cds1.DisableControls;
try
cds1.Filtered := false;
cds1.MergeChangeLog;
datalist := TStringList.Create;
try
linelist := TStringList.Create;
try
linelist.Delimiter := #1;
linelist.StrictDelimiter := true;
cds1.First;
while not cds1.Eof do begin
linelist.Clear;
for fld in cds1.Fields do begin
linelist.Add(fld.Text);
end;
datalist.Add(linelist.DelimitedText);
cds1.Next;
end;
finally
linelist.Free;
end;
datalist.SaveToFile(CurrentFileName);
finally
datalist.Free;
end;
finally
cds1.Filtered := FilterStatus;
cds1.EnableControls;
end;
if Current <> -1 then cds1.RecNo := Current;
end;