Search results

Create a RDLC report using business object data source

This section describes step by step procedure to create an RDLC report using Visual Studio Reporting project type.

Create an application

  1. Open Visual Studio 2013 from the File menu and select New Project.

  2. Select the Visual C# and choose the reporting project type from the project type list, and then select the Reports Application project type.

  3. Set the project’s name to RDLCReportsApplication and click OK.

    If you do not have the Business Intelligence or Report Server Project options, you should update SSDT with the Business Intelligence templates. Refer to Download SQL Server Data Tools.

    Create new reporting application project

Create business object class

  1. In the Solution Explorer, right-click the project and click Add > Class, and then name it as ProductSales.cs and click Add.

  2. Create the properties and method as desired. You can use the following codes to the newly created class.

    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; }
    }
  3. Clean and build the application.

Add an RDLC report

  1. Right-click the project and click Add > New Item.
  2. Click the reporting project type and select the Report Wizard template, and then name the report as SalesReport.rdlc.
  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

  2. Expand the tree view and select ProductSales, and then click Finish. Choose data object class in the application namespace

  3. In the DataSet Properties wizard, specify the dataset name as SalesData. Set rdlc dataset properties

  4. Drag the fields into Values, Row, and Column groups, and then click Next. Arrange table row, column and value groups

  5. Choose the table layout and click Next.

  6. Select table style and click Finish. Choose table toggle, repeat header and total options

Now, the RDLC report is displayed in the Visual Studio as follows. Visual Studio design output of the sales report