procedure TForm1.FormCreate(Sender: TObject); Var i:integer; begin // i:=15; self.FDMemTable1.FieldDefs.Add('ID',ftstring,10); self.FDMemTable1.FieldDefs.Add('ID1',ftstring,10); self.FDMemTable1.FieldDefs.Add('ID2',ftstring,10); self.FDMemTable1.FieldDefs.Add('ID3',ftstring,10); self.FDMemTable1.FieldDefs.Add('ID4',ftstring,10); Self.FDMemTable1.CreateDataSet; for i := 1 to 15 do begin Self.FDMemTable1.AppendRecord([IntTOSTR(i),'ID'+IntTOSTR(i)]); Self.StringGrid1.RowCount:=Self.StringGrid1.RowCount+1; end; end;
//TFDMemTable 代替 TClientDataSet
class="Delphi">procedure TForm1.FormCreate(Sender: TObject); begin with FDMemTable1.FieldDefs.AddFieldDef do begin Name := 'word'; DataType := ftString; Size := 50; end; with FDMemTable1.FieldDefs.AddFieldDef do begin Name := 'ph'; DataType := ftString; Size := 50; end; with FDMemTable1.FieldDefs.AddFieldDef do begin Name := 'note'; DataType := ftString; Size := 255; end; with FDMemTable1.FieldDefs.AddFieldDef do begin Name := 'num'; DataType := ftInteger; end; FDMemTable1.IndexDefs.Add('Index_1', 'word', [ixPrimary]); FDMemTable1.CreateDataSet; end;
本文来自博客园,作者:del88,转载请注明原文链接:https://www.cnblogs.com/del88/p/4217986.html