JavaScript Editor Ajax toolkit     Ajax tutorials 

Main Page

Previous Page
Next Page

9.2. Creating an SMO Project in Visual Studio .NET

This example shows you how to build a simple C# SMO Console application using Visual Studio 2005. Follow these steps:

  1. Select File New Project from the Visual Studio 2005 main menu.

  2. In the New Project dialog box, select Visual C# as the project type and select Console Application from the installed templates.

  3. Enter a name for the project and specify the location in which to save the project. Click OK.

  4. Right-click References in the Solution Explorer window. Select Add Reference from the context menu.

  5. In the Add Reference dialog box, add a reference to the Microsoft.SqlServer.ConnectionInfo.dll and Microsoft.SqlServer.Smo.dll assemblies.

  6. Click OK to close the dialog box and add the references.

  7. In the Solution Explorer window, right-click the file Program.cs. Select View Code from the context menu.

  8. Expose SMO types by adding the following using directives to the code:

        using Microsoft.SqlServer.Management.Smo;
        using Microsoft.SqlServer.Management.Common;

    Add using directives for any other types that you need access to.

Previous Page
Next Page

JavaScript Editor Ajax toolkit     Ajax tutorials