ISecurityConnection.CreateCommandO

Syntax

CreateCommandO(Options: DalCommandOption; Sql: String): IDalCommand;

Parameters

Options. SQL query work mode.

Sql. SQL query that will be executed on command execution.

Description

The CreateCommandO creates a new object that is used to work with database using SQL queries in the specified mode.

Example

Executing the example requires that the repository contains a table named TABLE .

Add links to the Dal and Metabase system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    Connection: ISecurityConnection;
    Command: IDalCommand;
    Cursor: IDalCursor;
    Field: IDalCursorField;
Begin
    MB := MetabaseClass.Active;
    Connection := MB.LogonSession.PrimaryConnection;
    // Create a command
    Command := Connection.CreateCommandO(DalCommandOption.NoCursorInQuery, "Select * From Table");
    // Create a cursor with data extraction
    Cursor := Command.CreateCursor;
    // View obtained values
    While Not Cursor.Eof Do
        For Each Field In Cursor.Fields Do
            Debug.WriteLine(Field.Name + " " + Field.Value);
        End For;
        Debug.WriteLine("");
        Cursor.Next;
    End While;
    // Close cursor and command
    Cursor.Close;
    Command.Close;
End Sub UserProc;

After executing the example the command is created based on the current connection, which executes SQL queries without cursor use. SQL query will be executed and results will be obtained. Results will be displayed in the development environment console.

See also:

ISecurityConnection