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 a Microsoft® SQL Server™ installation. Based on the installed version, Dmoping creates an instance of a version-specific SQLServer object, then uses that object in additional processing.
Applications developed using SQL-DMO version 7.0 cannot connect to or administer installations of versions of SQL Server released prior to 7.0. Applications that must administer SQL Server version 7.0 installations and installations of prior versions 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:
The Dmoping sample is a console application.
Dmoping requires Microsoft Visual C++® version 5.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, Dmoping requires installation of SQL-DMO version 6.5 or earlier.
CoCreateInstance; Application::GetDBLibraryVersionString; Application::GetODBCVersionString; Application::GetVersionBuild; Application::GetVersionMajor; pApplication::GetVersionMinor; ErrorInfo::GetDescription; ErrorInfo::GetSource; GetErrorInfo; Release; SQLServer::Connect; SQLServer::DisConnect; SQLServer::GetApplication; SQLServer::PingSQLServerVersion; SQLServer::SetLoginSecure; SysFreeString