(Lookup), .
.
property LookupDataSet: TDataSet;
.
property LookupResultField: String;
LookupDataSet, .
property LookupKeyFields: String;
( ) , LookupResultField.
property KeyFields: String;
( ) , .
. TDBGrid. , . , , .
(new field). Lookup (. 5). .
5
, . . , . - OnCalcFields . , , , , SQL:
OnCalcFields , , , .
, ( SQL). , ( , ) . OnCalcFields AutoCaicFieids:= False.
"", .
|
|
, OnCalcFields .
Delphi, SQL- . (:), . SQL- :
select * from AIRPORT where AP_CT_CODE =:CtCode
, .
SQL- , (bind). , , . Params ParamByName.
Params TParams ( TParams .). , , .
property Items[Index: Word]: TParam;
property ParamValues[const ParamName: String]: Variant;
, . . . ( SQL ).
function ParamByName(const Value: String): TParam;
SQL . .
TParam .
property Name: String;
property DataType: TFieldType;
.
, .
property IsNull: Boolean;
True, Null.
property Bound: Boolean;
True , .
procedure Clear;
Null.
property Value: Variant;
, . As..., , . , AsInteger Integer ( ). , Integer. , VARCHAR(10), Delphi .
As..., TParam , TField
property AsString: String;
|
|
property AsInteger: Integer;
property AsDateTime: TDateTime;
property AsBoolean: Boolean;
property AsCurrency:Currency;
property AsFloat: Double;
, .
SQL- :
Query1.Params[0].AsInteger:= 9;
:
Query1.ParamByName('CtCode').AsInteger:= 9;
.