Data.DB.TBinaryField.Create

From RAD Studio API Documentation
Jump to: navigation, search

C++

/* TField.Create */ inline __fastcall virtual TBinaryField(System::Classes::TComponent* AOwner) : TField(AOwner) { }

Properties

Type Visibility Source Unit Parent
constructor public Data.DB.hpp Data.DB TBinaryField

Description

Creates an instance of TBinaryField.

Most applications do not explicitly create instances of TBinaryField. Instead, the field components are created automatically, as persistent field components defined in the Fields editor at design time or as dynamic field components created automatically by the dataset.

The AOwner parameter specifies the component, typically a dataset, that becomes the new field's Owner. The Owner is responsible for freeing the component.

In the rare cases when you must create a persistent field component at runtime, call Create to create and initialize an instance of TBinaryField. After instantiating a TBinaryField, associate it with a specific field by setting its FieldName property to the name of the field. Give the TBinaryField a unique identifier in the Name property. Establish where the field appears in the collection of fields by providing an ordinal number in the Index property. Associate the TBinaryField with a dataset component by setting its DataSet property to the name of the dataset component.

The example below creates a TBinaryField object for a field named RawData accessed through a TSQLQuery named SQLQuery1.



var
T: TBinaryField;
begin
SQLQuery1.Close;
T := TBinaryFieldCreate(SQLQuery1);
T.FieldName := 'RawData';
T.Name := SQLQuery1.Name + T.FieldName;
T.Index := SQLQuery1.FieldCount;
T.DataSet := SQLQuery1;
SQLQuery1.FieldDefs.UpDate;
SQLQuery1.Open;
end;



TBinaryField *T;
SQLQuery1->Close();
T = new TBinaryField(SQLQuery1);
T->FieldName = "RawData";
T->Name = SQLQuery1->Name + T->FieldName;
T->Index = SQLQuery1->FieldCount;
T->DataSet = SQLQuery1;
SQLQuery1->FieldDefs->UpDate();
SQLQuery1->Open();



See Also