Report Wizard in Visual Studio 2015

Introduction

A report is a very good thing for showing output. Using a report a user can easily understand the overall output of data. This article explains client-side reporting. As its name client-side report means, generating a report on the client machine. Using the client-side reporting tools we can create a report at the local server instead of the centralized server. When Visual Studio starts people use Visual Studio 2005. Microsoft has provided the Crystal Reports option to create reports of any data, as well as time goes away the technology will also emerge. Now at the current time Microsoft has made it very easy to create a report in Visual Studio. So in this article we use Visual Studio 2015 and we learn how to generate a report using the Report Wizard tool.

Report Wizard

The short form of the Report Wizard is RDLC. It is nothing new, basically it is a reporting tool provided by Visual Studio by which we can represent the data of any table in a report format.  In the Report Wizard we can also create charts depending on our needs. But basically it is used to show the data in report format with a tabular mode or matrix mode. So let's discuss it with step-by-step examples showing how to create a wizard report in Visual Studio 2015 and use SQL Server 2008.

Step 1

First we open our SQL Server 2008 and  create a new database in it. The query for creating the database is given below.

  1. Create database EmployeeSal  
Step 2

After creating a database we create a table in the created database. Here you can make the column according  to your needs, I used nine columns to create the table. The query for creating the table in the database is given below.
  1. CREATE TABLE [dbo].[employee](  
  2.     [id] [intNOT NULL,  
  3.     [firstname] [varchar](20) NULL,  
  4.     [lastname] [varchar](20) NULL,  
  5.     [title] [varchar](30) NULL,  
  6.     [age] [intNULL,  
  7.     [yearofservice] [intNULL,  
  8.     [salary] [intNULL,  
  9.     [perks] [intNULL,  
  10.     [email] [varchar](60) NULL);  
Step 3

When the table has been created successfully we add some data into the table that we show in our report, so for inserting the data into the database we use the insert query as given below.
  1. insert into employee values(6,'Manoj','Kumar','Network engineer',30,2013,15000,1200,'[email protected]')  


Step 4

After creating the database successfully we open the Visual Studio 2015, go to the File menu, then New, then go with Project. In the template field select Visual C# and select Window Forms Application, name it as you desire.



Step 5

Now you will see your project in the Solution Explorer, so here we will add a dataset to the project. So use the following procedure to create the dataset. In the Solution Explorer right-click on your project name then select Add, select the Add New Item template just as in the given picture.



Here you will see a template window. There are many items available in the template field. In those fields select the dataset field just like the picture.



Step 6

After adding the dataset into your project you will see a window like the following. In this window you have two optiond for configuring the data set, one is the Server Explorer and the other is to use the Table Adapter tool from the toolbar. So here we will use the Table Adapter tool for configuring the dataset.



When you click on the Toolbar option then the toolbar will open. Now from the toolbar select the Table Adapter, drag and drop it onto the screen. When you drag and drop it onto the screen you will have a popup like this.



This popup window is for creating the connection string. So let's see how we create the connection string.

Click on the New Connection Button then again a window is shown. In this window fill in the server name. From the radio button select the "use SQL Server Authentication" option. Now insert your user name and password then from the drop down list select that database name that you want to use in your report.



When you fill it in successfully and clicked on the OK button then you will get a window like this.


 

Now click on the Next button, you will get again a new window. Do nothing in it, just click on it and go forward. Now you will again have a new window. In that window also do nothing, new just click on the Next button and go forward. After that you will see a window that has an option for the Query Builder. In this you will write the query that you want to show the data in the report. Here I use a select query because here I want to fetch the data from the database and show it in the report using the Report Wizard.



After this again click on "Next" and the next two times and then click on Finish. When you have successfully finished it you will see a data set as in the following picture.



Step 7

Now we add a Report Wizard into the project. That is simple, go the Solution Explorer, right-click on your project, click on Add New Item then select the reporting in the template field. Now you will see two templates, one is Report and the second is Report Wizard. We select the second one for Report Wizard.



Step 8

Now we have a window. In that window we select the data set that is generated by us. When we select it, it will automatically show all fields that are present in the table.



Now simply click on the Next button. You will again get a new popup window. In that window you manage the columns and rows for your report that you want to show in the report.



Now click on the Next button. You will see a sample of the report, something like the picture. You also have the template for changing the view of your report.



Step 9

Here our report is ready. We now want to show it, so just add a simple web form to the project using the Solution Explorer. Now in the window form from the tools in the reporting template we select the report Viewer tool and drop it onto the form.

Step 10

Now simply open the Report Viewer tool and choose the Report Wizard. Using the Report Wizard choose the data source.



Step 11

Now simply build your application and run it so you will see an output window with the report.

Output



Summary

As I said previously, client-side reports are a very important tool for presenting data from the client machine. It works on the local data. Here I told you all the processes for making the Report Wizard in Visual Studio 2015 and SQL Server 2008. I hope this article will be helpful for the readers for creating the Report Wizard at the client side.

Up Next
    Ebook Download
    View all
    Learn
    View all