Tuesday, August 8, 2017

Create SSRS RDLC report from Business Object

This blog explain how to create RDLC report from business or custom object and it will demonstrates the steps by steps how to define the RDLC file and how to bind the report data source with business object.

Here is a business class which stores report data.

   public class Employee
    {
        public int EmployeeID { getset; }
        public string Name { getset; }
        public int Age { getset; }
        public string City { getset; }

    }

Here is a method which call repository class - EmployeeRepository.cs to populate to employee object collection

  public List<Employee> GetEmployeesCityWise(string City)
        {
            EmployeeRepository _repository = new EmployeeRepository();
            List<Employee> employees = _repository.GetEmployees(City);
            return employees;


        }

Below are steps to create rdlc report and bind with business object

1.     Add new RDLC report and View Report Data (View --> Report data): 

RDLC - Data Source Type
Data Source Type



2.   Add new Data set and select data Source Type as Object


3.   Select Data Object (employee) what you want to bind to Report 


RDLC - Data Source Configuration Wizard
Data Objects

4.     Now you can view a list of available fields in data object

RDLC - DATA SET Properties



5.   Drag and Drop object Fields on report

RDLC Design Layout
RDLC

Thanks for Visiting !!

No comments:

SQL Server - Identify unused indexes

 In this blog, we learn about the index usage information (SYS.DM_DB_INDEX_USAGE_STATS) and analyze the index usage data (USER_SEEKS, USER_S...