The requested page is not available for the requested platform. You are viewing the content for Default platform.
All docs
V18.2
19.1 (preview)
18.2
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

Lesson 1 - Add a Report and Bind It to Data

This lesson describes how to create a new report and bind it to a database. The lesson also shows how to specify a master-detail relationship between database queries.

  1. Open an existing application or create a new application.

  2. Select PROJECT | Add New Item... in the Visual Studio main menu or press CTRL+SHIFT+A.

    add-new-item-windows-forms

  3. In the Add New Item dialog, select the DevExpress v18.2 Report item and click Add.

  4. In the invoked Report Wizard, select Table Report and click Next.

  5. On the next wizard page, choose Database and click Next to proceed.

  6. On the next page, select the first option to create a new data connection. Click Next.

  7. Choose Microsoft Access 97 as a data provider and specify a path to the nwind.mdb file. You can find this file in the XtraReports installation (the default path is C:\Users\Public\Public Documents\DevExpress Demos 18.2\Components\Data\nwind.mdb). Click Next to continue.

  8. Click Next on the next page to save the connection string to the configuration file.

  9. Choose the Categories and Products tables to add them to the report.

    Click Manage Relations to specify a master-detail relationship between the selected tables.

    In the invoked editor, drag and drop the CategoryID key field from the master table (Categories) to the detail table (Products).

    winforms-report-wizard-master-detail-relations-editor

    Click OK to close the editor.

    Note

    You can also click the Queries category's report-wizard-multi-query-page-icon-add button to create a custom query in the Query Builder. It allows you to join multiple tables and shape data at the data source level.

  10. Click Finish to stop the wizard at this step and get a blank data-bound report.

The default report layout contains three different bands (Top Margin, Detail and Bottom Margin). You cannot delete these bands.

  • The Top and Bottom Margins are printed once on each document page.
  • The Detail band is printed for every record in a report's data source.

report-bands-design-time-default-layout

The report's DataSource property is set to the created data source object. The DataMember property is set to the Categories master table.

The Report Explorer displays the report structure in a tree-like form and provides access to report components. The Field List reflects a data source's hierarchy.

 

Next Lesson: Lesson 2 - Create a Master-Detail Layout