Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

SAMPLE: How to Retrieve Hierarchical Rowsets from XML Data Using MSDAOSP in ATL OLE DB

View products that this article applies to.

This article was previously published under Q272182

↑ Back to the top


The Oledbospxml.exe sample demonstrates how to retrieve hierarchical OLE DB rowsets from an arbitrary XML document using the the Microsoft OLE DB Simple Provider (MSDAOSP) that ships with Microsoft Data Access Components (MDAC) version 2.6.

↑ Back to the top

More information

The following file is available for download from the Microsoft Download Center:
Release Date: Oct. 12, 2000

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� 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. The Oledbospxml.exe file contains the following files:

Collapse this tableExpand this table
File nameSize
EULA.txt2 KB
Oledbospxml.cpp10 KB
Portfolio.xml1 KB

The OSP Provider that ships with MDAC 2.6 has been enhanced to support opening hierarchical OLE DB rowsets over arbitrary XML files. It supports four different naming conventions to specify the path to the file:
  • http://
  • file://
  • UNC path
  • Full DOS path


  • Client-side cursors are not supported.
  • Rowsets that are created with the OSP are read-only.
  • The XMLDSO (MSXML2.DSOControl.2.6) adds an additional column of Data ($Text) to each rowset in the hierarchy.
This sample loads an arbitrary XML document, Portfolio.xml, into the OSP Provider and outputs data in the form of hierarchical OLE DB rowsets. In addition, the sample provides a CMyRowset class that supports chapters. Using this class, it illustrates how to traverse the Parent-Child hierarchy recursively and simultaneously output data, ignoring the $Text field.

Steps to Run the Sample

  1. Create an empty Win32 console application.
  2. Insert the Oledbospxml.cpp file into the project.
  3. Copy Portfolio.xml into the project folder.
  4. Make sure that the project is compiled using the Msdaosp.h file that ships with the MDAC 2.6 Software Development Kit (SDK).
  5. Compile and then run the application.

↑ Back to the top


OLE DB 2.6 Documentation
271778� SAMPLE: How to Retrieve Hierarchical Recordsets from XML Data Using MSDAOSP with ADO in Visual C++

↑ Back to the top

Keywords: KB272182, kbhowto, kbfile, kbdtl, kbdownload

↑ Back to the top

Article Info
Article ID : 272182
Revision : 7
Created on : 8/5/2004
Published on : 8/5/2004
Exists online : False
Views : 390