How to: Create a Master-Detail Report in Snap

  • 2 minutes to read

This tutorial describes the steps used to create a master-detail report, i.e., a report that is displays data from a hierarchical datasource.

Follow these steps to create a master-detail report.

Connect to a Data Source

  1. Start Microsoft Visual Studio 2012, 2013, 2015, 2017 or 2019, and create a new Windows Forms application or open an existing application.
  2. Drop the SnapControl from the DX21.1: Reporting Toolbox tab on the application’s main form.
  3. Next, open the PROJECT menu and click the Add New Data Source… command.


  4. Select Database.


  5. Select Dataset to specify the type of the database model..


  6. Select the nwind database. By default, it is stored in the following folder: C:\Users\Public\Documents\DevExpress Demos 21.1\Components\Data.


  7. The final wizard page allows you to choose which tables to obtain from the database. After this step, click Finish.


  8. To connect the application to data, handle the Load event of the application’s main form and write the following code in the event handler.

    using System;
    using System.Data.OleDb;
    using System.Windows.Forms;
    using Master_Detail_Report.nwindDataSetTableAdapters;
    // ...
    private void Form1_Load(object sender, EventArgs e) {
        string path = 
    "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Users\\Public\\Documents\\DXperience 12.2 Demos\\Data\\nwind.mdb";
        var dataSource = new nwindDataSet();
        var connection = new OleDbConnection();
        connection.ConnectionString = string.Format(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0}", path);
        var products = new ProductsTableAdapter();
        products.Connection = connection;
        var order_details = new Order_DetailsTableAdapter();
        order_details.Connection = connection;
        var bindingSource = new BindingSource();
        bindingSource.DataSource = dataSource;
        bindingSource.DataMember = "Products";
        snapControl1.Document.DataSource = bindingSource;

Arrange the Content

Run the Master-Detail Report to create it.

You can easily arrange the content of the report by dropping fields from the Field List window onto the report’s text editing surface.