//为记录复制建立临时表。
function CreateTableInMemory(const AFieldDefs: TFieldDefs): TDataSet;
var
TempTable: TClientDataSet;
begin
TempTable := nil;
Result := nil;
if AFieldDefs <> nil then
begin
try
TempTable := TClientDataSet.Create(Application);
TempTable.FieldDefs.Assign(AFieldDefs);
TempTable.CreateDataSet;
Result := (TempTable as TDataSet);
except
if TempTable <> nil then TempTable.Free;
raise;
end
end
end;