Item(Index: Integer): IDalCommandParam;
Index is an index of the parameter.
The Item property returns parameters of the SQL query.
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;
Com.Execute;
Com.Close;
End Sub Main;
After executing this example the connection to the BD database is established and 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.
See also: