更多详细操作,请见:https://www.cnblogs.com/karkash/p/16310441.html
01]建立缓存表
procedure TForm1.FormCreate(Sender: TObject); begin FDMemTable1.Close(); FDMemTable1.FieldDefs.Clear(); //定义表结构 FDMemTable1.FieldDefs.Add('ID', ftInteger, 0, True); FDMemTable1.FieldDefs.Add('Name', ftString, 20, false); FDMemTable1.CreateDataSet(); //添加数据 FDMemTable1.AppendRecord([101, 'aaa']); FDMemTable1.AppendRecord([102, 'bbb']); FDMemTable1.AppendRecord([103, 'ccc']); FDMemTable1.AppendRecord([1201, 'ddaaa']); FDMemTable1.AppendRecord([1202, 'ddbbb']); FDMemTable1.AppendRecord([1203, 'dsccc']); end;
02]获得指定 单元格 的值
procedure TForm1.Button1Click(Sender: TObject); var i: Integer; begin for i := 0 to FDMemTable1.SourceView.Rows.Count - 1 do begin Caption := FDMemTable1.SourceView.Rows.ItemsI[i].GetData(0); //i 为行, 0 为列 end; end;
//4行1列的值。
FDMemTable1.Data.DataView.Rows.ItemsI[4].ValueI[1] FDMemTable1.Table.Rows[4].ValueI[1]