How to: Bind a Report to an MDB Database (Runtime Sample)

This tutorial describes how you can bind your Snap report to an .mdb database.

  1. Start Microsoft Visual Studio 2012, 2013, 2015, 2017 or 2019, and create a new Windows Forms application or open an existing one.
  2. Drop the SnapControl from the DX21.1: Reporting Toolbox tab on the form.
  3. To connect the application to data, handle the Load event of the application’s main form and add the following code in the event handler.

    using System;
    using System.Windows.Forms;
    using System.Data;
    using System.Data.OleDb;
    // ...
    private void Form1_Load(object sender, EventArgs e) {
        string path = 
    "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Users\\Public\\Documents\\DevExpress Demos 14.1\\Components\\Data\\nwind.mdb";
        DataSet ds = new DataSet();
        OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT * FROM Orders", @path);
        adapter.Fill(ds, "OrderReports");
        snapControl1.Document.DataSource = ds;

The Snap application is now ready. Run it to create your report.

To design the report layout, drop fields from the Data Explorer onto the report editing surface.

 BindReportToMDB Database_AddNewColumn.png