IQuery.Sql

Syntax

Sql: String;

Description

The Sql property determines the text of SQL query to a database of the Query object.

Example

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

Sub Main;

Var

MB: IMetabase;

CrInf: IMetabaseObjectCreateInfo;

MObj: IMetabaseObject;

Query: IQuery;

Begin

MB := MetabaseClass.Active;

CrInf := Mb.CreateCreateInfo;

CrInf.ClassId := MetabaseObjectClass.KE_CLASS_QUERY;

CrInf.Id := "New_Query";

CrInf.Name := "New_Query";

CrInf.Parent := Mb.Root;

MObj := Mb.CreateObject(CrInf).Edit;

Query := MObj As IQuery;

Query.Database := Mb.ItemById("BD").Bind As IDatabase;

Query.Sql := "SELECT * FROM Table_1";

MObj.Save;

End Sub Main;

After executing the example, a new query is created in repository root. On executing this query, data is selected from the Table_1 table.

See also:

IQuery