Creating a DBMS Command

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

Sub Main;

Var

MB: IMetabase;

CrInfo: IMetabaseObjectCreateInfo;

MObj: IMetabaseObject;

SQLCom: ISQLCommand;

Begin

MB := MetabaseClass.Active;

CrInfo := MB.CreateCreateInfo;

CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_SQLCOMMAND;

CrInfo.Id := "NewSqlCommand";

CrInfo. Name: = "New DBMS command";

CrInfo.Parent := MB.Root;

MObj := MB.CreateObject(CrInfo).Edit;

SQLCom := MObj As ISQLCommand;

SQLCom.Database := MB.ItemById("BD").Bind As IDatabase;

SQLCom.Text("ORCL") := "Insert Into Table_1(Field1, Field2) Values(12, 12)";

MObj.Save;

End Sub Main;

After executing the example a new DBMS Command is created in repository root. On executing the command, a record with the specified values of two fields is added to the table with the physical name Table_1.

See also:

Examples