Skip to main content
Login Register
Code2night
  • Home
  • Blog Archive
  • Learn
    • Tutorials
    • Videos
  • Interview Q&A
  • Resources
    • Cheatsheets
    • Tech Comparisons
  • Languages
    • Angular Angular js ASP.NET Asp.net Core ASP.NET Core, C# ASP.NET MVC ASP.NET Web Forms C C# C#, ASP.NET Core, Dapper
      C#, ASP.NET Core, Dapper, Entity Framework DotNet General Web Development HTML, CSS HTML/CSS Java JavaScript JavaScript, HTML, CSS JavaScript, Node.js Node.js
      Python Python 3.11, Pandas, SQL Python 3.11, SQL Python 3.11, SQLAlchemy Python 3.11, SQLAlchemy, SQL Python 3.11, SQLite React Security SQL Server TypeScript
  • Post Blog
  • Tools
    • Beautifiers
      JSON Beautifier HTML Beautifier XML Beautifier CSS Beautifier JS Beautifier SQL Formatter
      Dev Utilities
      JWT Decoder Regex Tester Diff Checker Cron Explainer String Escape Hash Generator Password Generator
      Converters
      Base64 Encode/Decode URL Encoder/Decoder JSON to CSV CSV to JSON JSON to TypeScript Markdown to HTML Number Base Converter Timestamp Converter Case Converter
      Generators
      UUID / GUID Generator Lorem Ipsum QR Code Generator Meta Tag Generator
      Image Tools
      Image Converter Image Resizer Image Compressor Image to Base64 PNG to ICO Background Remover Color Picker
      Text & Content
      Word Counter PDF Editor
      SEO & Web
      SEO Analyzer URL Checker World Clock
  1. Home
  2. Blog
  3. ASP.NET MVC
  4. Create and display SSRS Report in ASP.NET MVC

Create and display SSRS Report in ASP.NET MVC

Date- Jun 11,2022 Updated Jan 2026 11981 Free Download Pay & Download
SSRS SSRS Report

SQL Database part

Here, find the scripts to create the database and table.

Create Database

 USE [master]
GO

/****** Object: Database [DbEmployee] Script Date: 9/29/2016 2:37:24 AM ******/
CREATE DATABASE [DbEmployee]
CONTAINMENT = NONE
ON PRIMARY
( NAME = N'DbEmployee', FILENAME = N'c:\Program Files (x86)\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\DbEmployee.mdf' , SIZE = 3072KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
LOG ON
( NAME = N'DbEmployee_log', FILENAME = N'c:\Program Files (x86)\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\DbEmployee_log.ldf' , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO

ALTER DATABASE [DbEmployee] SET COMPATIBILITY_LEVEL = 110
GO

IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [DbEmployee].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO

ALTER DATABASE [DbEmployee] SET ANSI_NULL_DEFAULT OFF
GO

ALTER DATABASE [DbEmployee] SET ANSI_NULLS OFF
GO

ALTER DATABASE [DbEmployee] SET ANSI_PADDING OFF
GO

ALTER DATABASE [DbEmployee] SET ANSI_WARNINGS OFF
GO

ALTER DATABASE [DbEmployee] SET ARITHABORT OFF
GO

ALTER DATABASE [DbEmployee] SET AUTO_CLOSE OFF
GO

ALTER DATABASE [DbEmployee] SET AUTO_CREATE_STATISTICS ON
GO

ALTER DATABASE [DbEmployee] SET AUTO_SHRINK OFF
GO

ALTER DATABASE [DbEmployee] SET AUTO_UPDATE_STATISTICS ON
GO

ALTER DATABASE [DbEmployee] SET CURSOR_CLOSE_ON_COMMIT OFF
GO

ALTER DATABASE [DbEmployee] SET CURSOR_DEFAULT GLOBAL
GO

ALTER DATABASE [DbEmployee] SET CONCAT_NULL_YIELDS_NULL OFF
GO

ALTER DATABASE [DbEmployee] SET NUMERIC_ROUNDABORT OFF
GO

ALTER DATABASE [DbEmployee] SET QUOTED_IDENTIFIER OFF
GO

ALTER DATABASE [DbEmployee] SET RECURSIVE_TRIGGERS OFF
GO

ALTER DATABASE [DbEmployee] SET DISABLE_BROKER
GO

ALTER DATABASE [DbEmployee] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO

ALTER DATABASE [DbEmployee] SET DATE_CORRELATION_OPTIMIZATION OFF
GO

ALTER DATABASE [DbEmployee] SET TRUSTWORTHY OFF
GO

ALTER DATABASE [DbEmployee] SET ALLOW_SNAPSHOT_ISOLATION OFF
GO

ALTER DATABASE [DbEmployee] SET PARAMETERIZATION SIMPLE
GO

ALTER DATABASE [DbEmployee] SET READ_COMMITTED_SNAPSHOT OFF
GO

ALTER DATABASE [DbEmployee] SET HONOR_BROKER_PRIORITY OFF
GO

ALTER DATABASE [DbEmployee] SET RECOVERY SIMPLE
GO

ALTER DATABASE [DbEmployee] SET MULTI_USER
GO

ALTER DATABASE [DbEmployee] SET PAGE_VERIFY CHECKSUM
GO

ALTER DATABASE [DbEmployee] SET DB_CHAINING OFF
GO

ALTER DATABASE [DbEmployee] SET FILESTREAM( NON_TRANSACTED_ACCESS = OFF )
GO

ALTER DATABASE [DbEmployee] SET TARGET_RECOVERY_TIME = 0 SECONDS
GO

ALTER DATABASE [DbEmployee] SET READ_WRITE
GO

Create Table

USE [DbEmployee]
GO

/****** Object: Table [dbo].[Employee_tbt] Script Date: 9/29/2016 2:38:05 AM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[Employee_tbt](
[id] [int] IDENTITY(1,1) NOT NULL,
[Name] [varchar](50) NULL,
[Designation] [varchar](50) NULL,
[Gender] [varchar](50) NULL,
[JoinDate] [date] NULL,
[Salary] [float] NULL,
[City] [varchar](50) NULL,
[State] [varchar](50) NULL,
[Zip] [int] NULL,
CONSTRAINT [PK_Employee_tbt] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

Create your MVC application

Open Visual Studio and select File >> New Project.

The "New Project" window will pop up. Select ASP.NET Web Application (.NET Framework), name your project, and click OK.

Create and display SSRS Report in ASPNET MVC


Create and display SSRS Report in ASPNET MVC 2

Now, a new dialog will pop up for selecting the template. We are going to choose the MVC template and click the OK button.

Create and display SSRS Report in ASPNET MVC 3

After creating our project, we are going to add DataSet.

Create DataSet

In order to add DataSet component, right click on Reports

folder > Add > New Item > Select DataSet > click Add button.

Create and display SSRS Report in ASPNET MVC 4

Create and display SSRS Report in ASPNET MVC 5

Next, click on Server Explorer link.

Now, the Server Explorer section will be shown as given below. Right click on Data connections > Select Add Connection

Create and display SSRS Report in ASPNET MVC 6

As you can see below, we need to select the server name, then via a drop-down list in connect to a database panel. You should choose your database name. Finally, click OK.

Create and display SSRS Report in ASPNET MVC 7

Here, we will work with the Employee_tbt table. For this, the next step is to drag our table, as shown below.

Create and display SSRS Report in ASPNET MVC 8

Create Report

For creating a report, right click on Reports folder > Add > New Item > Select Reporting. Here, we have three components. Select Report, and finally click Add.

Create and display SSRS Report in ASPNET MVC 9


Create and display SSRS Report in ASPNET MVC 10

Create and display SSRS Report in ASPNET MVC 11

Create and display SSRS Report in ASPNET MVC 12

After clicking on Add, a new window will pop up. We need to name our Dataset and choose the data source (in this case, via a dropdown list, select MyDataSet, which has been created previously).

Next, we will design a table. Specify all fields that you want to display in your report.

Create and display SSRS Report in ASPNET MVC 13

Note - In order to start, you will need to install the ReportViewer for MVC. Run the following command in the Package Manager Console Or Manage the NuGet package from the solution 

search - ReportViewerForMvc

PM> Install-Package ReportViewerForMvc

Create a Controller

Now, we are going to create a Controller. Right-click on the Controllers folder > Add > Controller> selecting MVC 5 Controller – Empty > click Add.

using Microsoft.Reporting.WebForms;

using System;

using System.Collections.Generic;

using System.Configuration;

using System.Data.SqlClient;

using System.Linq;

using System.Web;

using System.Web.Mvc;

using System.Web.UI.WebControls;



namespace SSRSReport.Controllers

{

    public class HomeController : Controller

    {

        MyDataSet ds = new MyDataSet();

        public ActionResult ReportEmployee()

        {

            ReportViewer reportViewer = new ReportViewer();

            reportViewer.ProcessingMode = ProcessingMode.Local;

            reportViewer.SizeToReportContent = true;

            reportViewer.Width = Unit.Percentage(15000);

            reportViewer.Height = Unit.Percentage(15000);

            var connectionString = "Data Source=.;Initial Catalog=DbEmployee;Integrated Security=True";

            SqlConnection conx = new SqlConnection(connectionString);

            SqlDataAdapter adp = new SqlDataAdapter("SELECT * FROM Employee_tbt", conx);

            adp.Fill(ds, ds.Employee_tbt.TableName);

            reportViewer.LocalReport.ReportPath = Server.MapPath(@"/MyReport.rdlc");

            reportViewer.LocalReport.DataSources.Add(new ReportDataSource("MyDataSet", ds.Tables[0]));

            ViewBag.ReportViewer = reportViewer;

            return View();

        }

    }

}


Adding View

In Employee Controller, right-click on ReportEmployee() action. Select Add View and a dialog will pop up. Write a name for your View and click Add.

Here, I’m creating the ReportEmployee() action which will select all data from the Employee_tbt table.

Create and display SSRS Report in ASPNET MVC 14

Create and display SSRS Report in ASPNET MVC 15

Create and display SSRS Report in ASPNET MVC 16


@using ReportViewerForMvc;
@{
    ViewBag.Title = "ReportEmployee";
}
@Html.ReportViewer(ViewBag.ReportViewer as Microsoft.Reporting.WebForms.ReportViewer)

Create and display SSRS Report in ASPNET MVC 17

S
Shubham Batra
Programming author at Code2Night — sharing tutorials on ASP.NET, C#, and more.
View all posts →

Related Articles

Get Channel Videos using YouTube Data Api in Asp.Net
Apr 13, 2023
How to export view as pdf in Asp.Net Core
Jul 05, 2022
The report definition is not valid or is not supported by this version of reporting
Jul 02, 2022
Import Excel in Asp.net MVC using OLE DB
Jun 23, 2022
Previous in ASP.NET MVC
How to Integrate Linkedin Login in Asp.net MVC
Next in ASP.NET MVC
Excel Export in Asp.Net MVC using XlWorkbook
Buy me a pizza

Comments

🔥 Trending This Month

  • 1
    HTTP Error 500.32 Failed to load ASP NET Core runtime 6,938 views
  • 2
    Error-An error occurred while processing your request in .… 11,272 views
  • 3
    Comprehensive Guide to Error Handling in Express.js 235 views
  • 4
    ConfigurationBuilder does not contain a definition for Set… 19,459 views
  • 5
    Mastering JavaScript Error Handling with Try, Catch, and F… 161 views
  • 6
    Mastering Unconditional Statements in C: A Complete Guide … 21,497 views
  • 7
    Unable to connect to any of the specified MySQL hosts 6,232 views

On this page

🎯

Interview Prep

Ace your ASP.NET MVC interview with curated Q&As for all levels.

View ASP.NET MVC Interview Q&As

More in ASP.NET MVC

  • Implement Stripe Payment Gateway In ASP.NET 58743 views
  • Jquery Full Calender Integrated With ASP.NET 39657 views
  • Microsoft Outlook Add Appointment and Get Appointment using … 27583 views
  • How to implement JWT Token Authentication and Validate JWT T… 25286 views
  • Payumoney Integration With Asp.Net MVC 23231 views
View all ASP.NET MVC posts →

Tags

AspNet C# programming AspNet MVC c programming AspNet Core C software development tutorial MVC memory management Paypal coding coding best practices data structures programming tutorial tutorials object oriented programming Slick Slider StripeNet
Free Download for Youtube Subscribers!

First click on Subscribe Now and then subscribe the channel and come back here.
Then Click on "Verify and Download" button for download link

Subscribe Now | 1770
Download
Support Us....!

Please Subscribe to support us

Thank you for Downloading....!

Please Subscribe to support us

Continue with Downloading
Be a Member
Join Us On Whatsapp
Code2Night

A community platform for sharing programming knowledge, tutorials, and blogs. Learn, write, and grow with developers worldwide.

Panipat, Haryana, India
info@code2night.com
Quick Links
  • Home
  • Blog Archive
  • Tutorials
  • About Us
  • Contact
  • Privacy Policy
  • Terms & Conditions
  • Guest Posts
  • SEO Analyzer
Dev Tools
  • JSON Beautifier
  • HTML Beautifier
  • CSS Beautifier
  • JS Beautifier
  • SQL Formatter
  • Diff Checker
  • Regex Tester
  • Markdown to HTML
  • Word Counter
More Tools
  • Password Generator
  • QR Code Generator
  • Hash Generator
  • Base64 Encoder
  • JWT Decoder
  • UUID Generator
  • Image Converter
  • PNG to ICO
  • SEO Analyzer
By Language
  • Angular
  • Angular js
  • ASP.NET
  • Asp.net Core
  • ASP.NET Core, C#
  • ASP.NET MVC
  • ASP.NET Web Forms
  • C
  • C#
  • C#, ASP.NET Core, Dapper
  • C#, ASP.NET Core, Dapper, Entity Framework
  • DotNet
  • General Web Development
  • HTML, CSS
  • HTML/CSS
  • Java
  • JavaScript
  • JavaScript, HTML, CSS
  • JavaScript, Node.js
  • Node.js
  • Python
  • Python 3.11, Pandas, SQL
  • Python 3.11, SQL
  • Python 3.11, SQLAlchemy
  • Python 3.11, SQLAlchemy, SQL
  • Python 3.11, SQLite
  • React
  • Security
  • SQL Server
  • TypeScript
© 2026 Code2Night. All Rights Reserved.
Made with for developers  |  Privacy  ·  Terms
Translate Page
We use cookies to improve your experience and analyze site traffic. By clicking Accept, you consent to our use of cookies. Privacy Policy
Accessibility
Text size
High contrast
Grayscale
Dyslexia font
Highlight links
Pause animations
Large cursor