API:Data.DB.TMemoField.Create
Delphi
constructor Create(AOwner: TComponent); override;
C++
__fastcall virtual TMemoField(System::Classes::TComponent* AOwner);
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
constructor | public | Data.DB.pas Data.DB.hpp |
Data.DB | TMemoField |
Description
Creates an instance of a BLOB field component.
Data.DB.TMemoField.Create inherits from Data.DB.TBlobField.Create. All content below this line refers to Data.DB.TBlobField.Create.
Creates an instance of a BLOB field component.
Most applications do not explicitly create instances of TBlobField. 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.
Create initializes the DataType property to ftBlob. 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 TBlobField. After instantiating a TBlobField, associate it with a specific field by setting its FieldName property to the name of the field. Give the TBlobField 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 TBlobField with a dataset component by setting its DataSet property to the name of the dataset component.
The example below creates a TBlobField object for a field named Images accessed through a TSQLDataSet named SQLDataSet1.
var
T: TBlobField;
begin
SQLDataSet1.Close;
T := TBlobField.Create(SQLDataSet1);
T.FieldName := 'Images';
T.Name := SQLDataSet1.Name + T.FieldName;
T.Index := SQLDataSet1.FieldCount;
T.DataSet := SQLDataSet1;
SQLDataSet1.FieldDefs.UpDate;
SQLDataSet1.Open;
end;
SQLDataSet1->Close();
TBlobField *T = new TBlobField(SQLDataSet1);
T->FieldName = "Images";
T->Name = SQLDataSet1->Name + T->FieldName;
T->Index = SQLDataSet1->FieldCount;
T->DataSet = SQLDataSet1;
SQLDataSet1->FieldDefs->UpDate();
SQLDataSet1->Open();