IDalCommandParam.Name

Syntax

Name: String;

Description

The Name property returns the name of the SQL query parameter that is used to execute the command at the database server.

Example

Executing the example requires that the repository contains a database with the BD identifier.

Add links to the Collection, Dal, Db, and Metabase system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    DB: IDatabaseInstance;
    Com: IDalCommand;
    Params: IDalCommandParams;
    Param_List: IStringList;
    i: Integer;
Begin
    MB := MetabaseClass.Active;
    Param_List := New StringList.Create;
    DB := MB.ItemById("BD").Open(NullAs 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
        Param_List.Add(Params.Item(i).Name);
        Params.Item(i).Value := (i + 2) * 10;
    End For;
    Com.Execute;
    Com.Close;
End Sub UserProc;

After executing the example the connection to the BD database is established and the SQL query that extracts all records from the Table_1 table, for which the values of the Num1 and Num2 fields satisfy the assigned parameters, is executed. The Param_List variable contains a list of the SQL query parameters that are used to execute the command.

See also:

IDalCommandParam