Data.DB.TLongWordField.AssignValue
Delphi
procedure AssignValue(const Value: TVarRec); override;
C++
virtual void __fastcall AssignValue(const System::TVarRec &Value);
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
procedure function |
public | Data.DB.pas Data.DB.hpp |
Data.DB | TLongWordField |
Description
Sets the field value using one of the AsInteger, AsBoolean, AsString or AsFloat properties.
Data.DB.TLongWordField.AssignValue inherits from Data.DB.TField.AssignValue. All content below this line refers to Data.DB.TField.AssignValue.
Sets the field value using one of the AsInteger, AsBoolean, AsString or AsFloat properties.
Use AssignValue to assign a value to a field and, in Delphi, that comes from an array of const. AssignValue uses an As property for the assignment based on the type of the Value parameter:
Value | As... property used |
---|---|
vtInteger |
AsInteger |
vtBoolean |
AsBoolean |
vtChar |
AsString |
vtExtended |
AsFloat |
vtString |
AsString |
vtPChar |
AsString |
vtAnsiString |
AsString |
vtCurrency |
AsCurrency |
vtVariant |
AsVariant |
If Value is not one of the types in the table, but is of type TObject or a TObject descendant, AssignValue uses the Assign method to assign the value to the field.
AssignValue exists primarily for internal use. In C++ applications and components, use the TField::Value property instead. In most Delphi situations, you should use the data type-specific assignment properties like AsString and AsInteger. In cases where a component or an application must be able to make field assignments from untyped arrays, the syntax for AssignValue looks like that below. In this example, a custom data class uses AssignValue in a member method named SetFieldValues to assign values to multiple fields. The values for the field assignments come from an untyped array.
procedure TCustomDataClass.SetFieldValues(Values: array of const);
var
i: Integer;
begin
for i := 0 to High(Values) do
Fields[i].AssignValue(Values[i]);
end;