Microsoft Knowledge Base Email Alertz

Oledbpp.exe is a sample that uses OLE DB, with Visual C++ 6.x, to demonstrate the use of the

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 198489 - Last Review: March 14, 2005 - Revision: 2.3

Oledbpp.exe Demonstrates IDBProperties::GetPropertyInfo()

This article was previously published under Q198489

On This Page

SUMMARY

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

MORE INFORMATION

The following file is available for download from the Microsoft Download Center:
Oledbpp.exe (http://download.microsoft.com/download/ole/sample3/2.0/w9xnt4/en-us/oledbpp.exe)
Release Date: Jan-07-1999

For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:
119591  (http://kbalertz.com/Feedback.aspx?kbNumber=119591/EN-US/ ) How to Obtain Microsoft Support Files from Online Services
Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.

Using the Sample File

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 the use of IDBProperties::GetPropertyInfo(). Also demonstrated are IDBProperties::SetProperties() and IDBInitialize::Initialize(). Extensive in-line comments describe the detailed syntax of the OLE DB methods and structures.

Conventions

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.

NOTE: This sample uses Microsoft Jet, which is not included in MDAC 2.6. To use this sample you must have Microsoft Jet OLEDB Provider installed on the computer.
// 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:
//     DBPROPSET_DATASOURCEALL
//     DBPROPSET_DATASOURCEINFOALL
//     DBPROPSET_DBINITALL
//     DBPROPSET_ROWSETALL
//     DBPROPSET_SESSIONALL
// 
//  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.

				

REFERENCES

MSDN: Technical Articles/Data Access/Implementing ADO with Various Development Languages (http://msdn.microsoft.com/library/techart/msdn_adorosest.htm)

APPLIES TO
  • Microsoft OLE DB 1.5
  • Microsoft OLE DB 2.0
  • Microsoft OLE DB 2.1
  • Microsoft OLE DB 2.5
  • Microsoft OLE DB 2.6
  • Microsoft ActiveX Data Objects 1.5
  • Microsoft ActiveX Data Objects 2.0
  • Microsoft ActiveX Data Objects 2.01
  • Microsoft ActiveX Data Objects 2.1
  • Microsoft ActiveX Data Objects 2.5
  • Microsoft ActiveX Data Objects 2.6
Keywords: 
kbdownload kbdatabase kbfile kbinfo KB198489
Retired KB ArticleRetired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate