Dmoping
The Dmoping sample illustrates version-independent SQL-DMO application development. The sample demonstrates using the SQL-DMO version 7.0 PingSQLServerVersion function to determine the version of an instance of Microsoft® SQL Server™. Based on the instance, Dmoping creates an instance of a version-specific SQLServer object, then uses that object in additional processing.
Default Location
C:\Program Files\
Microsoft SQL Server\80\Tools\Devtools\Samples\sqldmo\cpp\dmoping
Running the Sample
- Open the Dmoping.dsw project.
- Run the application.
Remarks
Applications developed using SQL-DMO version 7.0 or later cannot connect to or administer instances of SQL Server released prior to 7.0. Applications that must administer instances of SQL Server version 7.0 or earlier can simultaneously reference the SQL-DMO version 7.0 object library and a version of the library released prior to version 7.0.
The sample shows:
- Creating an instance of a SQLServer object.
- Calling the PingSQLServerVersion function to determine the version of an instance of SQL Server.
- Creating and connecting a version-specific instance of a SQL-DMO SQLServer object based on the PingSQLServerVersion return value.
The Dmoping sample is a console application.
Dmoping requires Microsoft Visual C++® version 6.0 or later. Project files for Visual C++ (.dsp and .dsw extensions) are included. In the project files, build configurations are defined for computers using Intel® or compatible processors. All configurations create a Unicode application.
Dmoping illustrates using SQL-DMO in an environment containing multiple versions of SQL Server. In addition to an installation of SQL-DMO version 7.0 or later, Dmoping requires installation of SQL-DMO version 6.5 or earlier.
Functions and Methods Illustrated
Application::GetDBLibraryVersionString | pApplication::GetVersionMinor |
Application::GetODBCVersionString | Release |
Application::GetVersionBuild | SQLServer::Connect |
Application::GetVersionMajor | SQLServer::DisConnect |
CoCreateInstance | SQLServer::GetApplication |
ErrorInfo::GetDescription | SQLServer::PingSQLServerVersion |
ErrorInfo::GetSource | SQLServer::SetLoginSecure |
GetErrorInfo | SysFreeString |