Article ID: 272185 - Last Review: August 9, 2004 - Revision: 4.4 SAMPLE: How to Retrieve Data Using a SQL XML Query in ATL OLE DBThis article was previously published under Q272185 On This PageSUMMARY OLEDBSQLXML.exe demonstrates how to create an ATL OLE DB
client that extracts an XML Stream from a SQL 2000 Server using a SQL XML
Query. MORE INFORMATIONThe
following file is available for download from the Microsoft Download
Center: OLEDBSQLXML.exe
(http://download.microsoft.com/download/mdac26/w3ds/2.6/w9x2k/en-us/oledbsqlxml.exe)
Release Date:
Oct-11-2000For 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://support.microsoft.com/kb/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.
The OLEDBSQLXML.exe file contains the following files:
Collapse this table
This sample requires the client to connect to a SQL Server 2000 Server using the Microsoft SQL Server OLE DB Provider (SQLOLEDB) that ships with Microsoft Data Access Components (MDAC) version 2.6 or later. Prior versions of SQL Server always returned data in the some form of recordset as a result of executing a 'SELECT..' SQL Statement. In SQL Server 2000, the 'SELECT ...' SQL Statement has been enhanced to include a new FOR XML clause, frequently called a SQL XML query. This clause allows SQL Server to return data in the form of an XML document. In the SQLOLEDB provider that ships with MDAC 2.6, the ICommand::Execute method has been enhanced to return XML data using an ISequentialStream interface instead of IRowset. The SQL XML query can be executed by setting up the ICommandStream interface to contain the SQL XML query or by passing the query to the ICommandText::SetCommandText method. The sample does this as follows:
Steps to Run the Sample
APPLIES TO
| Article Translations
|
Back to the top
