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.

Setting a reference to SMO

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, ...

Get Programming Microsoft® SQL Server™ 2008 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.