Mar 9, 2011

Configuring SSRS

Hi to all friends,

Well, due to a special request from a special friend I felt to put SSRS stuff over here.

What this Post contains
While integrating SSRS Report, the report.rdl file is loaded inside ReportViewer Control but, An issue occurs, that the report asks for Credentials Every Time.
This post contains C# code which can set Credentials dynamically from Web.config which may resolve the issue.

Prior Knowledge Required
To go through this Post, a programmer requires a prior knowledge of SSRS Reports Developing and Deploying.
[Its consider in prior that A Programmer is aware about 1),2),3),4) & 5) Points]

1). MIS.rdl File is uploaded over SSRS.

2). form_Report_Stock.aspx & form_Report_Stock.aspx.cs Both Page are well coded including ReportViewer Control.

3). form_Report_Stock.aspx.cs
using Microsoft.Reporting.WebForms;

4). form_Report_Stock.aspx
<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>

5). form_Report_Stock.aspx.cs
Inside Page Load event of write following code:

if (!IsPostBack && !IsCallback)
List parameters = new List();
parameters.Add(new ReportParameter("P01Name","P01Value"));
parameters.Add(new ReportParameter("P02Name","P02Value"));
parameters.Add(new ReportParameter("P03Name","P03Value"));
parameters.Add(new ReportParameter("Connection_String",str_Cn)); //P04Name may Contain Connection String
ReportServiceUtilities.PrepareReport(rvControl,"Report_Name", parameters);

You need to download the ReportServiceUtilities.cs Class.

Also, Note to confirm following settings over SSRS:





You will be able to set the SSRS Report Credentials Dynamically.

For any doubts please Leave comments,
I will try to revert ASAP for any issue.


No comments:

Post a Comment