下面是创建内存表的例子 Dataset 是一个 TClientDataSet
DataSet.Close ;
with DataSetdo
begin
FieldDefs.Clear ;
// 重新定义临时表
with FieldDefs.AddFieldDefdo
begin
DataType := ftString ;
Size := 30;
Name := 'FTableInfoName' ;
end;
with FieldDefs.AddFieldDefdo
begin
DataType := ftString ;
Name := 'FDate' ;
Size := 10;
end;
with FieldDefs.AddFieldDefdo
begin
DataType := ftString ;
Size := 250;
Name := 'FTableChange' ;
end;
IndexDefs.Clear ;
with IndexDefs.AddIndexDefdo
begin
Fields := 'FTableInfoName;FDate';
Name := 'ixPrimary';
end;
CreateDataSet;
Open ;
end;