9.3. A Simple SMO ApplicationThis example displays the product title for the local SQL Server instance and the hardware platform for the computer running the SQL Server instance. You need a reference to the Microsoft.SqlServer.ConnectionInfo.dll and Microsoft.SqlServer.Smo.dll assemblies to compile and execute this example. using System; using Microsoft.SqlServer.Management.Smo; class Program { static void Main(string[] args) { Server server = new Server("localhost"); Console.WriteLine("Product: " + server.Information.Product); Console.WriteLine("Platform: " + server.Information.Platform); Console.WriteLine(Environment.NewLine + "Press any key to continue."); Console.ReadKey( ); } } The console output looks something like the output shown in Figure 9-1. Figure 9-1. Console output for a simple SMO application![]() The Information property of the Server class returns an Information object that exposes information about the SQL Server instance through its properties. |