Alter;
The Alter method updates a role according to the set options.
The method is automatically called at object saving if role parameters have been changed. The role parameters are defined by the DerivedPassword, Mode, Name, Password properties.
Executing the example requires the EditBox1 and EditBox2 components of the EditBox type located 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 Button2OnClick(Sender: Object; Args: IMouseEventArgs);
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;
Role.Mode := DatabaseApplicationRoleMode.On_;
Role.DerivedPassword := True;
Role.Name := EditBox1.Text;
Role.Password := EditBox2.Text;
Role.Alter;
DbObj.Save;
End Sub Button2OnClick;
After executing the example, using of application role is enabled and credentials are set for it.
See also: