Working with SMO in Microsoft Visual Studio
To get started working with SMO, you must first set a reference in the Visual Studio project to the SMO assembly by choosing Project, Add Reference and then selecting the Microsoft.SqlServer.Smo, Microsoft.SqlServer.SmoExtended, Microsoft.SqlServer.Management.Sdk.Sfc, and Microsoft.SqlServer.ConnectionInfo components, as shown in Figure 4-1.
Figure 4-1. Setting a reference to SMO
You then add two using statements for the two namespaces that you will use most often, as shown here:
using Microsoft.SqlServer.Management.Common; using Microsoft.SqlServer.Management.Smo;
Next you will want to work with SMO objects, ...