Share via


Walkthrough: Retrieving Multiple Rows As XML

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

The latest Enterprise Library information can be found at the Enterprise Library site.

This walkthrough demonstrates how to retrieve XML data from a SQL Server database.

To reproduce the demonstration

  1. Configure the database. For the necessary steps, see "QuickStart Configuration" in Data Access QuickStart.
  2. Create the database (when you are not using the Unity Integration approach). The following code uses the factory to create a SqlDatabase object that has the default configuration.
  3. Create the command by adding the following code. It creates a DbCommand used with a SQL string.
  4. Add the following code to call ExecuteXmlReader and process the results.
  5. Close the XmlReader and Connection by adding the following code.