FILE: Oledbpp.exe Demonstrates IDBProperties::GetPropertyInfo()

ID: Q198489

The information in this article applies to:


Oledbpp.exe is a sample that uses OLE DB, with Visual C++ 6.x, to demonstrate the use of the IDBProperties::GetPropertyInfo() method.


The following file is available for download from the Microsoft Software Library:

 ~ Oledbpp.exe (size: 91136 bytes) 

Release Date: Jan-07-1999

For more information about downloading files from the Microsoft Software Library, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q119591
   TITLE : How to Obtain Microsoft Support Files from Online Services

The contents of Oledbpp.exe include the following:

    FileName      Description

   Adodemo.mdb    The sample Microsoft Access database
   Oledbpp.cpp    The main module for the OLEDBPP Application
   Oledbpp.h      Header for the OLEDBPP Application
   Oledbppdlg.cpp The module containing the OLE DB code
   Oledbppdlg.h   Header for the COLEDBPPDlg class
   Pperror.cpp    Edited version of error.cpP from RowsetViewer sample
   Pperror.h      Header for the Pperror.cpp file
   Stdafx.cpp     Build generated
   Stdafx.h       Build generated

What OLEDBPP Demonstrates

OLEDBPP is a sample that demonstrates similar functionality to that of the ProviderProperties() procedure (found in AdoCore.cpp) of the ADO sample application Adovc.exe in Knowledge Base article Q174565 (see REFERENCES section). Basically, this sample demonstrates the use of IDBProperties::GetPropertyInfo(). Also demonstrated are IDBProperties::SetProperties() and IDBProperties::Initialize(). Extensive in-line comments describe the detailed syntax of the OLE DB methods and structures.


In the sample, pointers to OLE DB interfaces are named following the convention: p<Object><Interface>, unless the <Object> name is included in <Interface>, (for example, pICommandWithParameters or pIRowset). For example, pDataSourceIDBInitialize or pSessionIDBCreateCommand.

Calling IDBProperties::GetPropertyInfo

As an example of the kind of in-line tutorial provided, the following code fragment demonstrates the use of the IDBProperties::GetPropertyInfo() method.

   // Dump connection properties

   DBPROPSET*       rgPropSets = NULL;
   ULONG            cPropSets = 0;

   ULONG            cPropertyIDSets = 0L;
   ULONG            cPropertyInfoSets;
   DBPROPINFOSET*   rgPropertyInfoSets; // Returned by provider
   OLECHAR*         pDescBuffer;  // Returned by provider

   //  typedef struct  tagDBPROPINFOSET
   //    {
   //    /* [size_is] */ PDBPROPINFO rgPropertyInfos;
   //    ULONG cPropertyInfos;
   //    GUID guidPropertySet;
   //    }   DBPROPINFOSET;
   // The DBPROPINFOSET structure's guidPropertySet, if set, will be
   // one of the following:
   //  typedef struct  tagDBPROPINFO
   //    {
   //    LPOLESTR pwszDescription; // A text description of the property
   //    DBPROPID dwPropertyID; // The ID of the property

   //    DBPROPFLAGS dwFlags;   // A bitmask that describes the property
   //    VARTYPE vtType;        // The type indicator of the property
   //    VARIANT vValues; // Alist of the supported values for the
   //                     // property*
   //    }   DBPROPINFO;
   //    * Normally this list is returned only if the property can be
   //      set and either:
   //      (a) The property type is an integer and the possible values of
   //          the property are an enumerated type.
   //      (b) The property type is an integer whose bits are to be read
   //          as a bitmask and all supported bits are set.
   //      (c) The property type is a string and the possible values form
   //          a small, well-defined set.  The definition of a small, well-
   //          defined set is provider-specific.  (If this list is
   //          returned the vt element in vValues is VT_ARRAY combined with
   //          the type indicator returned in vtType.  If this list is not
   //          returned,the vt element is VT_EMPTY.  The consumer must free
   //          any memory pointed to by elements of vValues by calling the
   //          COM function VariantClear.

     hr = pDataSourceIDBProperties->GetPropertyInfo(cPropertyIDSets,
           NULL, // Since above is 0L, this is ignored by provider
           &cPropertyInfoSets, // # DBPROPINFOSET structures returned
           &rgPropertyInfoSets, // The DBPROPINFOSET structures themselves
           &pDescBuffer); // Memory location with pointer to string data
                        // Each individual string value is null-terminated.


For additional information, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q174565
   TITLE     : FILE: Adovc.exe Demonstrates How to Use ADO with Visual C++

   MSDN: Technical Articles/Data Access/"Implementing ADO with Various
   Development Languages, The ADO Rosetta Stone"

(c) Microsoft Corporation 1998. All Rights Reserved. Contributions by Ken Rahmes, Microsoft Corporation

Additional query words:

Keywords          : kbDatabase kbOLEDB 
Version           : WINDOWS:1.5,2.0,2.01,2.1
Platform          : WINDOWS

Last Reviewed: January 8, 1999