Count: Integer;
The Count property returns the number of parameters that are used in SQL query.
Executing the example requires that the repository contains a database with the BD identifier.
Add links to the Dal, Db, and Metabase system assemblies.
Sub UserProc;
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 UserProc;
After executing the example the connection to the BD database is established, after which 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: