Create an RDLC report using business object data source

To create an RDLC report for the Bold Reports® ASP.NET Web Forms Report Viewer that uses a business object data source, build a class library with the data class, add a report with the Visual Studio Report Wizard, and then configure the data source and table.

Prerequisites

If you are using Microsoft Visual Studio lower to 2017 version then you should update SSDT with the Business Intelligence templates. Refer to Download SQL Server Data Tools.

How do I create the business object class?

To create the business object class for an RDLC report in the Bold Reports® ASP.NET Web Forms Report Viewer, add a class with the report fields to a class library project in Visual Studio.

  1. Open Visual Studio from the File menu and select New Project.
  2. Create project with class library type from the project type list.

Add a new class library project 3. Create the class with the necessary properties. Use the following code as a reference.

```csharp
public class ProductSales
{
    public string ProdCat { get; set; }

    public string SubCat { get; set; }

    public string OrderYear { get; set; }

    public string OrderQtr { get; set; }

    public double Sales { get; set; }
}
```
  1. Clean and build the application.

How do I add an RDLC report in Visual Studio?

To add an RDLC report in Visual Studio, use the Report Wizard item, which starts report creation with dataset selection.

  1. Right-click the project and click Add > New Item.
  2. Search Report with new item and select Report Wizard to start the creation with dataset selection.
  3. Click Add.

Add a new rdlc using report wizard template

Data source and table configuration wizard

  1. Choose object type from the Data Source Configuration wizard and click Next.

Select data source type in configuration wizard

  1. Expand the tree view and select ProductSales, and then click Finish.

Choose data object class in the application namespace

  1. In the DataSet Properties wizard, specify the dataset name as SalesData.

Set rdlc dataset properties

  1. Drag the fields into Values, Row, and Column groups, and then click Next.

Arrange table row, column and value groups

  1. Choose the table layout and click Next.
  2. Select table style and click Finish.

Choose table toggle, repeat header and total options

Visual Studio now displays the RDLC report design, as in the following image: Visual Studio design output of the sales report

To render the RDLC report in the Bold Reports® ASP.NET Web Forms Report Viewer, refer to the RDLC report section.