SQL-DMO Environment Setup

The first step to programming with SQL-DMO objects is to include the appropriate type library or header files in your project. To give Microsoft Visual Basic access to the SQL-DMO object definitions, you should include the SQL-DMO type library in your Visual Basic project or module. You must include the type library if you want to declare a Visual Basic object variable as a SQL-DMO object type, but not if you want to declare a Visual Basic object variable as a generic Object type.

In a Microsoft Visual C++ environment, the SQL-DMO objects include both ANSI and Unicode custom interfaces. The ANSI custom interfaces and ANSI SQLOLE_BSTR strings are used by default. To use the Unicode custom interfaces and Unicode SQLOLE_BSTR strings, you must define UNICODE and _UNICODE before including all the header files. To give your Visual C++ program access to the SQL-DMO object definitions, you must include the SQLOLEID.H and SQLOLE.H files, in addition to the Windows and OLE header files. If you are using Visual Basic or Visual C++, there are other requirements and steps as well.

For more information about setting up your SQL-DMO programming environment, see the Microsoft SQL Server Programmer's Toolkit documentation in the "Database and Messaging Services" section of the Platform SDK.