I am trying to use Microsoft.SqlServer.Management.Smo
to extract server values in C#. I'm having difficulty with the syntax.
Server server = new Server(new ServerConnection { ConnectionString = new SqlConnectionStringBuilder { DataSource = @"localhost", IntegratedSecurity = true }.ToString() });
Dts.Variables["User::test"].Value = server.AuditLevel____??_____;
Trying to use the Server.AuditLevel
:
Could someone provide an exable using both "get" and "set"?
Following code worked
Dts.Variables["User::test"].Value = Convert.ToInt32(server.AuditLevel);
The Microsoft.SqlServer.Management.SqlEnum
reference needs to be added as well.