Add(Name: String): IDalCommandParam;
Name is a name of the parameter to be added.
The Add method adds a parameter that is used in the SQL query.
This method can be used, if the the Type property is set to DalCommandType.StoredProcedure.
Executing the example requires a database with the BD identifier in the repository. There is the Func_1 function that calculates any value on the server on which the database was set.
Sub Main;
Var
MB: IMetabase;
DB: IDatabaseInstance;
Com: IDalCommand;
v: Variant;
Begin
MB := MetabaseClass.Active;
DB := MB.ItemById("BD").Open(Null) As IDatabaseInstance;
Com := DB.Connection.CreateCommand("");
Com.Type := DalCommandType.StoredProcedure;
Com.SQL := "Func_1";
Com.Params.Add("Param").Direction := DalParamDirection.ReturnValue;
Com.Execute;
v := Com.Params.Item(0).Value;
Com.Close;
End Sub Main;
A command that executes the function or procedures stored on the server is created after executing this example. One parameter, in which the result of function execution returns, is created for the command. The result of the Func_1 function execution is contained in the "v" variable after executing this example.
See also: