IDomainCredentials.Domain

Syntax

Domain: String;

Description

The Domain property determines a name of the domain.

Example

Executing the example requires EditBox1 and EditBox2 of EditBox type on the form. The schema must contain a table with the Table identifier. The domain user, from profile of which the connection is established, should be added to the list of repository users and has such privileges as Login and Right for Reading and Opening All Objects.

Sub UserProc;

Var

MbDef: IMetabaseDefinition;

Package: ISecurityPackage;

dc:IDomainCredentials;

Mb: IMetabase;

MbManager: IMetabaseManager;

Table : ITable;

Field : ITableField;

Begin

Mb := Null;

MbManager := MetabaseManagerFactory.Active;

MbDef := MbManager.Definitions.FindById("P5_MS");

Debug.AssertMsg(MbDef <> Null, "Description of the metabase was not found");

Package := MbManager.Packs.FindById(MbDef.SecurityPackage).Package;

dc := Package.CreateCredentials(AuthenticationMode.Domain) As IDomainCredentials;

dc.LogonAsCurrentUser := False;

dc.Domain := "PROGNOZ";

dc.UserName := EditBox1.Text;

dc.Password := EditBox2.Text;

Mb := MbDef.Open(dc,ApplicationMode.Win,LocaleCodeID.Russian);

WinApplication.InformationBox(Connection is established);

Table := Mb.ItemById ("Table").Bind As ITable;

For Each Field In Table.Fields Do

Debug.WriteLine(Field.Name);

End For;

End Sub UserProc;

If the right password and user name are entered, the connection to the P5_MS scheme is established, and the message about it is shown. Names of table fields are displayed in a console window.

See also:

IDomainCredentials