views:

34

answers:

1

My C# application uses SMO to do various things with SQL Server instance chosen by a user. Particularly, it changes authentication mode:

ServerConnection conn = new ServerConnection(connection);
Server server = new Server(conn);

server.Settings.LoginMode = ServerLoginMode.Mixed;

After changing login more instance should be restarted. However, I cannot find any way in SMO to restart selected instance.

I've tried to google this, but only found a bunch of samples enumerating running services and comparing their names with SQL server service name. I did not like this way as it is error prone and relies on the way Microsoft currently names SQL server instances.

Is there any way to restart chosen instance in SMO?

A: 

It seems that no restart is required but rather the call of

server.Alter();

Is that correct?

Alex
No - just discovered this is not enough. Though SQL Management Studio shows Mixed Authentication after Alter, it is not possible to login with SQL Authentication. So restart is still needed and the question is still actual.
Alex