IDalCommandParams.Add

Syntax

Add(Name: String): IDalCommandParam;

Parameters

Name - name of the added parameter.

Description

The Add method adds a parameter that is used in the SQL query.

Comments

This method can be used if the the Type property is set to DalCommandType.StoredProcedure.

Example

Executing the example requires that the repository contains a database with the BD identifier. The server, on which the database was configured, contains the Func_1 function that calculates any value.

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;

After executing the example a command that executes the functions or procedures stored at the server is created. One parameter, in which the result of function execution is returned, is created for the command. After executing the command the "v" variable contains the Func_1 function execution result.

See also:

IDalCommandParams