IDalCommandParams.Count

Syntax

Count: Integer;

Description

The Count property returns the number of parameters that are used in SQL query.

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 + 1) * 10;

End For;

i := Params.Count;

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 set in the cycle. The "i" variable contains the number of parameters that are used in the SQL query.

See also:

IDalCommandParams