The following samples illustrate Microsoft® SQL Server™ 2000 SQL-DMO application development in Microsoft Visual C++® and Microsoft Visual Basic®.
|Soc||C language sample. Creates an instance of a SQLServer object and calls the Connect member function.|
|BackRestEvents (C++)||C++ language sample. Illustrates using SQL Server to backup and restore a database, and uses events to report the current status.|
|Dmoping||C++ language sample. Uses the PingSQLServerVersion method to query an instance of SQL Server. Illustrates using SQL-DMO in an environment containing multiple instances of SQL Server.|
|Smartptr||C++ language sample. Illustrates SQL-DMO development using COM object support built into Visual C++ 5.0|
|Socpp||C++ language sample. Creates an instance of a SQLServer object and calls the Connect member function.|
|AxSQLDMOCtl||Visual Basic sample. Demonstrates how to create a User Control that uses SQLDMO|
|BackRestEvents (Visual Basic)||Visual Basic sample. Illustrates using SQL Server to backup and restore a database, and uses events to report the current status.|
|BackupDevice||Visual Basic sample. Demonstrates how to use the BackupDevice Object to add and remove a backup device|
|CreateDatabase||Visual Basic sample. Demonstrates how to create a database.|
|CreateTable||Visual Basic sample. Demonstrates how to create and alter tables.|
|DMOExplorer||Visual Basic sample. Walks the DMO object model and displays the values in it.|
|Enums||Visual Basic sample. Demonstrates how to use the SQLServer enumeration methods.|
|Explore||Visual Basic sample. Illustrates using SQL-DMO to browse SQL Server configuration in an enterprise.|
|Idxtest||Visual Basic sample. Illustrates using SQL-DMO to build and test the benefit of SQL Server indexes.|
|Login||Visual Basic sample. Demonstrates how to locate the available SQL servers and log in to them.|
|Registry||Visual Basic sample. Demonstrates how to use the SQL DMO object model to find Registry information for an instance of SQL Server.|
|Service||Visual Basic sample. Demonstrates how to use the SQLServer object to check the status of the service, and to start and stop it.|
|SQLScripts||Visual Basic sample. Demonstrates how to generate SQL scripts to recreate various SQL Server objects.|
|VerifyBackup||Visual Basic sample. Demonstrates how to find backup devices and verify the backup set.|
To install the samples during SQL Server installation
- On the Setup Type page, select Custom.
- On the Select Components page, under Components, select Code Samples.
Samples are installed as a self-extracting file. To extract the samples, double-click Unzip_sqldmo.exe, located at
C:\Program Files\Microsoft SQL Server\80\Tools\Devtools\Samples\Sqldmo
All samples include a project file applicable to the language used.
The SQL-DMO C and C++ samples have been built for the Microsoft® Windows® 95, Windows® 98, Windows NT® 4.0, and Windows 2000 operating systems.
For C and C++ sample compilation, the Microsoft SQL Server™ development files must be installed to obtain the SQL-DMO header files. After installation, set your compiler include directory path to contain C:\Program Files\Microsoft SQL Server\80\Tools\DevTools\Include so that the compiler can access the Sqldmo.h and Sqldmoid.h files.
C and C++ samples require Microsoft Visual C++ version 6.0. Visual Basic samples require Microsoft Visual Basic version 6.0.