Show contents 

Db > Db Assembly Interfaces > IQuery > IQuery.Database

IQuery.Database

Syntax

Database: IDatabase;

Description

The Database property determines a database, in which the query is stored.

Example

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

Sub UserProc;
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 UserProc;

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