Introduction

Here is disclosed in point of interest to create RDLC reports in C#, RDLC is great business insight (BI) instrument. RDLC is the best part to show reports in tabular form.

Step 1: Add new project, select Windows Desktop, then select Windows Forms Application and afterwards solution name and then lastly hit on OK button.

Create Solution for RDLC Report



Step 2: Now right click on your solution and click option add new item then window will appear, now at right hand side select Reporting and then click on Reporting, type RDLC report name Report1.RDLC and lastly hit Add button.

RDLC Report


Step 3: Now click on Toolbox and expand Data, now add BindingSource to your project solution.

Binding Source

Step 4: Now mouse right click, Click on Add, next sub menu TableAdapter option.

tableAdapter1

Step 5: Now TableAdapter Configuration Wizard will open, here you'll able see different DataTable properties and then hit on Finish button.

TableAdapter Configuration Wizard

Step 6: Here you'll be  able to select Choose a Command type, three main Command Types are as follows:
  1. Use SQL Statements
  2. Make a new Stored Procedure
  3. Use Existing Stored Procedure
I am running with SQL statements, Click on Next button.

Choose a Command Type

Save the Connection String to the Application Config File

Keep checked the checbox to store the connection string into application config file.
Choose Methods to Generate
There are three returning methods:
  • Fill a DataTable
  • Return a DataTable
  • Create Methods to send updates directly to the database (GenerateDBDirectMethods)
  • Finally click on Next button.
TableAdapter Configuration Wizard

Choose Your Data Connection

Here you can create your database connection on New Connection button, there're options to save connection string into config file or not, here I'm clicking on Yes to save connection string into application config file, then click on Next button.

Choose Data Connection


Step 7: Now move to RDLC report, mouse right click, click on Insert option then click on sub option Table.
Insert Table

Dataset Properties

Here you'll able to type your dataset name “DataSet1” and can provide Data Source then you'll be able to choose Available Datasets from drop down, click on OK button.

Dataset Properties

Step 8: Now select Data Sources, here you'll be able see table entities, now drop these entities to RDLC report to populate.

Datasources

Step 9: Now right click on Table, here you can add Page Header, Page Footer

RDLC header footer

Step 10: Here now you'll see report is populated City Primary Key, City Name, In page header you'll be able to add RDLC Report (City Details).

RDLC Report Design Preview

Step 11: Once more click on Toolbox, Go to Reporting option, from here drag ReportViewer onto C# forms where ever  you've to populate reports.

Report Viewer

Step 12: Now right click on ReportViewer, you've to provide Data source and Choose Report Name.

Report Viewer

Step 13: Now you have to compile your application and run finally to see RDLC Reports final results.

City Details

RDLC Report Main Components

Here you can see main binding source of the project which are displaying in your project task bar.

dataReport

Summary

Here you'll be able to see in detail how can we generate RDLC reports in C#.

Download Example in Zip

Database Script is under folder db_Script
Development Environment: Visual Studio 2013, .NET Framework Version 4.5, MS SQL Server 2012 

Relevant Reading