Mode: DatabaseApplicationRoleMode;
The Mode property determines a mode of application role use. By default the application role is not used (DatabaseApplicationRoleMode.Off).
Executing the example requires the EditBox1 and EditBox2 components of the EditBox type on the form. The scheme should have a database with the DB identifier using a type of DBMS client, that is Microsoft SQL Server.
Sub UserProc;
Var
MB : IMetabase;
DbObj: IMetabaseObject;
Db : IDatabase;
Role : IDatabaseApplicationRole;
Begin
MB := MetabaseClass.Active;
DbObj := MB.ItemById("DB").Edit;
Db := DbObj As iDatabase;
Role := Db.Role;
If Role.Mode=DatabaseApplicationRoleMode.Off Then
Role.Mode := DatabaseApplicationRoleMode.On_;
Role.Name := EditBox1.Text;
Role.Password := EditBox2.Text;
End If;
DbObj.Save;
End Sub UserProc;
After executing the example, using of application role is enabled and credentials are set for it.
See also: