Skip to main content
A newer version of this page is available. .

Bind a Report to an XML File

  • 2 minutes to read

This tutorial demonstrates how to bind a report to data stored in an external XML file at design time within Visual Studio.

To bind a report to an XML file, do the following.

  1. Start Microsoft Visual Studio 2010, 2012, 2013, 2015 or 2017 and create a new application under any of the supported platforms, or open an existing one.
  2. Add a new blank report to it.
  3. Click the report’s smart tag. In the invoked actions list, expand the drop-down menu for the DataSource property and click Add Report Data Source…

    how-to-ef-datasource01

  4. On the first page of the invoked Data Source Wizard, select Database and click Next.

    data-source-wizard-select-type-page

  5. The next page allows you to specify whether you want to use an existing data connection or create a new data connection. Select the first option and click Next.

    data-source-wizard-specify-data-connection

  6. On the next page, specify the data provider (XML file) and the path to the Cars database file (the Cars.xml file is shipped with the installation of the XtraReports suite).

    how-to-sql-data-source01

    To proceed to the next wizard page, click Next.

  7. Click Next on the following page to save the created connection string to the configuration file.
  8. On the next page, you can choose which tables, views and/or stored procedures to add to the report. You can also construct custom queries using the Query Builder. Expand the Tables category, select the Cars item and click Finish to exit the wizard.

    data-source-wizard-xml-file-select-query-page

    Note

    Some of the data shaping capabilities available to SQL data sources (such as sorting, grouping and filtering data, as well as using aggregate functions) are not supported for XML files.

The newly created SQL data source will be displayed in the Components node of the Report Explorer. Additionally, the hierarchy of the data source will be reflected by the Field List.

how-to-sql-data-source02

See Also