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

Bind a Report to Data

  • 2 minutes to read

This tutorial demonstrates how to bind a report to a hierarchical data source and specify a master-detail relationship between data source queries.

Create a Data Model and Report

Before creating data-aware reports, you first need to define data models that obtain the necessary data from your data providers. For this tutorial, prepare the Northwind data model providing the Orders and Customers tables as well as the Order Details view.

report-server-northwind-data-model

Open an existing report or create a new one as described in the Create and Customize Reports document to get started with this tutorial.

Bind the Report to Data

To obtain a report’s dynamic data from an external data source, do the following:

  1. Click the main menu button and select Add SQL Data Source to create a new data source.

    report-server-menu-add-sql-data-source

  2. On the first page of the invoked SQL Data Source Wizard, select an available data model and click Next to proceed.

    report-server-data-source-wizard-select-data-model

  3. On the next page, you can choose which tables, views and/or stored procedures to add to the data source.

    Select the Order Details view. Create a custom query by clicking the plus button for the Queries category to display information from two different tables at the same hierarchical level.

    report-server-data-source-wizard-select-tables

    In the invoked Query Builder, add the Orders and Customers data tables to a query and join them based on a key column.

    report-server-data-source-wizard-query-builder

    Give the Orders name to the created query and click OK to close the Query Builder.

    Click Next on the wizard page to proceed.

  4. The next wizard page allows you to configure parameters for a custom query. Click Next to skip this step.

    report-server-data-source-wizard-configure-parameters

  5. On the following wizard page, define master-detail relationships between queries by specifying their corresponding key fields. Click the plus button next to the master query, choose the detail query to add a new relationship and specify the relationship condition as shown in the following image:

    report-server-data-source-wizard-master-detail-relation

  6. Click Finish to complete the wizard.

View the Result

The Field List displays the hierarchy of the data source after a report has been connected to data.

RS_FieldList_DataFields

A report’s Data Source and Data Member properties specify the report’s data binding.

RS_ReportDataSourceAndDataMember

See Also