Report Integration with Microsoft Report Viewer

Discussion in 'SQL Server' started by MinalS, May 13, 2015.

  1. MinalS

    MinalS New Member

    Jul 8, 2014
    Likes Received:
    Trophy Points:
    The Report in Visual Studio can be created by using the links to the report wizard provided by the viewer control. There are two types of ReportViewer controls in Visual Studio toolbox as mentioned below:
    1. ReportViewer Web server control for ASP.NET pages used for web hosting
    2. Report Viewer Windows Forms control for report display in windows form applications
    Report Viewer features

    ReportViewer controls are tools used for viewing the reports generated by SQL Server Reporting Services builder tool. Report Viewer controls have a view area for displaying the report and configurable toolbar in a report.


    The toolbar provides large number of features for windows and web versions. All features in the Windows version are enabled for displaying by default. Features like document map, navigation, controls for multi page report, zoom, print, export functionality are useful.

    The property window of the ReportViewer control helps to modify the items. The processing mode enables to specify the report is processed locally, on remote mode. The IDE provides programmatic interfaces to interact with the ReportViewer control using code. A dummy procedure displays the accessible properties and methods of the control in the drop down menu.

    Difference between web server and windows forms

    There are differences in the environment in which they are used. Lets understand the differences between them.
    1. The Report Viewer web control is useful in designing an ASP.NET web application. The Report Viewer windows control is useful in designing a windows application.
    2. The Report Viewer web control uses HTML as presentation format. The Report Viewer window control used the graphic device interface.
    3. The Report Viewer web control is configurable for asynchronous processing. The Report Viewer window control is used for local report and is processed as Windows background process configurable for asynchronous programming.
    4. The Report Viewer web control uses an ActiveX control for reports on remote server. The Report Viewer window control uses print functionality of operating system.
    5. The Report Viewer web control deployment takes the session information and web farm configuration. The Report Viewer windows control is similar to any windows application.
    6. The Report Viewer web control needs Internet Explorer 6.0 or above with the script enabled. The Report Viewer windows control does not need browser support.
    Report Viewer control for Windows

    To display a report in a desktop application, the Report Viewer control needs to be embedded with the Windows form.

    The following steps demonstrate the Report Viewer control in windows application.
    1. Open Visual Studio application by clicking Start, All Programs, Microsoft Visual Studio application
    2. Click File, New, and Project for creating a project application
    3. Click on Windows Forms Application in the Visual Studio installed templates. Modify the default name for the application.

    4. After adding the name, use the Browse button to select the location for an application.
    5. In the toolbox, click on the MicrosoftReportViewer control
    6. Click on the design view of the new report from the drop down menu

    7. Click Next Button
    8. The Data Source Configuration wizard window opens. Accept the default database and click on the Next Button
    9. Click on the New Connection button. In the Add Connection window, select Microsoft SQL Server Compact 3.5.
    10. In the Data Source configuration wizard window, add the connection information for the Connection String field. Click Next Button

    11. The Choose Database objects window appears to the user. Select the database objects. Click on the checkbox tables.

    12. Click on the Next button. The arrange fields window appears. Add the required fields in the summation values column as shown below.

    13. Choose the style and click Next button

    14. Click Finish button. Click on the Build menu item and start debugging.
    The following output is displayed.


    Report Viewer control for web application
    1. Click File, New Website, for opening the new website window as shown below:

    2. Highlight the ASP.NET web site and choose the location as HTTP. Add the website name and click ok.
    3. Click on the menu item Website, click Add New Item. Click on the DataSet in the templates. Click add button

    4. In the App code, right click from the drop down menu and select Add, Table Adapter.

    5. The data table is added to the designer window. Select the server for connection and click Next button.
    6. The SQL Server login page is visible to the user. Provide the authentication information. Click Ok
    7. In Save the Connection String to the Application Configuration page, accept the default value and click Next button
    8. In the Choose a Command Type page, accept the default Use SQL statements. Click Next button
    9. Add the SQL Statement page and add the data loaded into the table.

    10. Click on the Query builder button and open the interface. From the list of tables, select the required tables and add them to the Query builder.

    11. Click on Execute query button and check the SQL statement. Click Ok.
    12. The Choose methods to generate page of the wizard opens. Accept the default values and click Finish button.

    13. The configured data table in the designer window is as shown below

    14. Click on the menu item Add New item. Select Report from the installed templates.
    15. Click on the menu item Report, select data sources.
    16. Click Add to Report button. The selected data source is added to the report data sources.
    17. Click on the menu item Data from the drop down list, click Show Data sources.
    18. Click and add the fields from the data sources in the body of the report.
    19. Add the Report Viewer control to the aspx page. Select the rdlc extension file from the drop down list.
    20. Build the website and the aspx page is displayed.
    Last edited by a moderator: Jan 21, 2017

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice