API:FireDAC.Comp.Client.TFDAdaptedDataSet.AttachTable

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

procedure AttachTable(ATable: TFDDatSTable; AView: TFDDatSView); override;

C++

virtual void __fastcall AttachTable(Firedac::Dats::TFDDatSTable* ATable, Firedac::Dats::TFDDatSView* AView);

Properties

Type Visibility Source Unit Parent
procedure
function
public
FireDAC.Comp.Client.pas
FireDAC.Comp.Client.hpp
FireDAC.Comp.Client TFDAdaptedDataSet

Description

Attaches a dataset to an existing DatS table and optionally to the view.

FireDAC.Comp.Client.TFDAdaptedDataSet.AttachTable inherits from FireDAC.Comp.DataSet.TFDDataSet.AttachTable. All content below this line refers to FireDAC.Comp.DataSet.TFDDataSet.AttachTable.

Attaches a dataset to an existing DatS table and optionally to the view.

Use the AttachTable method to attach a dataset to an existing DatS table and optionally to the view to navigate, visualize, and edit their data using the standard TDataSet interface. Call the dataset OpenOrExecute method to activate the dataset after attaching it to DatS objects. Before the call, their structure must be filled in. To detach specified DatS objects from the dataset, call AttachTable with nil parameters.  The application is responsible for the creation and destruction of the specified table and view.

This method has meaning for TFDCustomMemTable descendants only and it is only used internally for other FireDAC datasets.

Example

var
  oTab: TFDDatSTable;
...
  oTab := TFDDatSTable.Create;
  oTab.Columns.Add('id', dtInt32);
  oTab.Columns.Add('name').Size := 13;
  oTab.Columns.Add('cnt', dtInt16);
  oTab.Columns.Add('price', dtCurrency);
  FDMemTable1.AttachTable(oTab, nil);
  FDMemTable1.Open;
  // working with FDMemTable1
  FDMemTable1.AttachTable(nil, nil);
  oTab.Free;

See Also