IDalCommandParam.Value

Syntax

Value: Variant;

Description

The Value property determines a value of the SQL query parameter that is used to execute the command at the database server.

Comments

The value specified in this property must have the same data type as set for the parameter. If the parameter has a custom type, the value is specified as a link to the data stream. To read more about working with custom type fields, use the knowledge base in the Working with Fields that have Custom Data Type article.

Example

Sub Main;

Var

MB: IMetabase;

DB: IDatabaseInstance;

Com: IDalCommand;

Params: IDalCommandParams;

i: Integer;

Begin

MB := MetabaseClass.Active;

DB := MB.ItemById("BD").Open(Null) As IDatabaseInstance;

Com := DB.Connection.CreateCommand("");

Com.SQL := "Select * From Table_1 Where Num1 > :Param And Num2 < :Param1";

Com.Parse;

Params := Com.Params;

For i := 0 To Params.Count - 1 Do

Params.Item(i).Value := (i + 2) * 10;

End For;

Com.Execute;

Com.Close;

End Sub Main;

After executing the example the connection to the BD database is established and then the SQL query that selects all records from the Table_1 table, for which the values of the Num1 and Num2 fields satisfy the assigned parameters, is executed. Values of the parameters are calculated in the cycle.

See also:

IDalCommandParam