Creating SMO Programs
Applies To: SQL Server 2016 Preview
General programming of SQL Server Management Objects (SMO) objects includes the common areas that all objects share, such as running methods, setting properties, and manipulating collections.
The most basic SMO program that establishes a connection to an instance of SQL Server. Demonstrates the Windows Authentication and SQL Server Authentication. Also includes samples that show connecting to a local and a remote instance of SQL Server.
A program that demonstrates how to disconnect from the instance of SQL Server.
This section describes the general approach to calling methods. Shows the use of parameters, and how to handle tables of data returned in a DataTable object. Also includes example of how to call an object constructor and how to call the Clone method.
This section describes how to set different types of properties. Show how to set and get object properties. Also includes examples that set object properties when the object is created, and how to iterate through all the properties of an object.
Various programs that discuss the techniques that are used with object collections. Shows how to reference an object using collections. Also includes an example of how to iterate through the members of a collection.
This section describes how to set up and handle events in SMO. Includes an example of how to set up an event handler and how to set up event subscription.
This section describes how to trap exceptions in SMO. Includes examples of how to catch an exception and how to display an inner exception.
This section describes how to work with the different SQL Server data types. Describes how to construct a datatype with the specification in the object constructor. Also includes example of how to create a datatype by using the default constructor.
This section describes how to implement transaction processing in an SMO program. Includes example of how to use transactions in an SMO program.
This section describes how to record the output of the SMO program. The example records the SMO program as Transact-SQL statements sent to the instance of SQL Server for later execution.