AnyDAC
ContentsIndexHome
PreviousUpNext
TADDataSet.AttachTable Method

Attaches dataset to existing DatS table and optionaly view.

Group
Links
Parameters 
Description 
ATable: TADDatSTable 
A DatS table, storing data. 
AView: TADDatSView 
A DatS view, representing rows. 

Use the AttachTable method to attach dataset to existing DatS table and optionally view to navigate, visualize and edit their data using standard TDataSet interface. Call dataset Open method to activate dataset after attaching to DatS objects. Before call theyr structure must be filled in. To detach specified DatS objects from dataset, call AttachTable with nils. 

The application is responsible for creation and destruction of specified table and view. 

This method has meaning for TADCustomMemTable descendants only. And it is used internally only for other AnyDAC datasets.

procedure AttachTable(ATable: TADDatSTable; AView: TADDatSView); virtual;
var
  oTab: TADDatSTable;
...
  oTab := TADDatSTable.Create;
  oTab.Columns.Add('id', dtInt32);
  oTab.Columns.Add('name').Size := 13;
  oTab.Columns.Add('cnt', dtInt16);
  oTab.Columns.Add('price', dtCurrency);
  ADMemTable1.Attach(oTab, nil);
  ADMemTable1.Open;
  // working with ADMemTable1
  ADMemTable1.AttachTable(nil, nil);
  oTab.Free;
What do you think about this topic? Send feedback!