Chapter-3:Opening/Calling the deployed SQL Server Reporting Server report from Asp.net

We have developed a Basic SSRS Report Chapter-1, and deployed the report to our reporting server in Chapter-2 now we can call the same through the client application. In this section, we will use Asp.net as the client application for calling the report, I am using VS 2010 for the purpose you may use 2010 or any higher version. The steps to do so are.

Download Full Tutorial for Chapter-3 Calling the deployed report from Asp.net

Step 1: Open Visual Studio. From File menu, choose New->Website. And from the available templates, choose ASP.Net Web site. And click OK button.

Select ASP.Net Web site
Select ASP.Net Web site




Step2: Create a web form CallSSRS.aspx and drag and drop the below controls into the designer layout from toolbox.One ScriptManager control, One Button control and One ReportViewer control.

: Create a web form CallSSRS.aspx
Create a web form CallSSRS.aspx

Step-3: The page will look like

image003

Step 4: Double click on the button and add the below code in the code behind of the Button click event

Protected Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click
Try
ReportViewer1.ShowParameterPrompts = False
ReportViewer1.ShowCredentialPrompts = False
Dim paracity As New ReportParameter(“city”, “London”)
ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote
ReportViewer1.ServerReport.ReportServerUrl = New Uri(“http://akanksha/ReportServer”)
ReportViewer1.ServerReport.ReportPath = “/BasicSSRS1/ReportSSRS1”
ReportViewer1.ServerReport.SetParameters(paracity)
ReportViewer1.ServerReport.Refresh()
Catch ex As Exception
Response.Write(ex.Message)
End Try
End Sub




Note: Please import Imports Microsoft.Reporting.WebForms on the code page as given in the image

Paste the code
Paste the code

Our report is located at “/BasicSSRS1/ReportSSRS1 path in the server, for this information we can click URIs present in the Report Manger URL of Reporting Services Configuration Manager.

ReportServerUrl” is the location where your SQL Server Reporting Services is running your can find the value of this parameter from the Report configuration manager as shown below.

of Reporting Services Configuration Manager
Reporting Services Configuration Manager
Web Service URL
Web Service URL

While typing in the value of ReportServerUrl in the button script avoid the port 80 as 80 is default port of IIS so need not to be mention in code, so the url will be

http://akanksha/ReportServer

On clicking the ReportServerUrl the screen below will appear which gives you the value of ReportPath which indicates the path where our report is deployed.

image007

Note: For running the ASP Project calling the SSRS report you may enable Google Chrome as default browser to avoid any script error initially, it will be explain in letter chapters how to deal with scripts debug of Internet Explorer.

Upon clicking BasicSSRS1 link we can open all the report deployed under the project and can open  ReportSSRS1.rdl  as shown in the image given below

open ReportSSRS1.rdl
open ReportSSRS1.rdl

So, in this section we understand how to call SSRS Report with parameter from client application i.e asp.net application.




Previous Related Post:

Chapter-1: Creating a basic Tabular SSRS Report using Report Wizard
Chapter-2 : Report Deployment on SQL Server 2012 Reporting Server
Chapter-3:Opening/Calling the deployed SQL Server Reporting Server report from Asp.net

One thought on “Chapter-3:Opening/Calling the deployed SQL Server Reporting Server report from Asp.net

Leave a Reply

Your email address will not be published. Required fields are marked *

*

13 + seventeen =