FireDAC.Comp.DataSet.TFDDataSet.AttachTable

From RAD Studio API Documentation
Jump to: navigation, search

[–] Properties
Type:
procedure
function
Visibility: public
Source:
FireDAC.Comp.DataSet.pas
FireDAC.Comp.DataSet.hpp
Unit: FireDAC.Comp.DataSet
Parent: TFDDataSet

Delphi

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

C++

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

Description

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