eric90125 eric90125 - 14 days ago 4x
ASP.NET (C#) Question

How can I pass a parameter value from to SSRS Stored procedure?

I have a web forms page that includes a ReportViewer for an SSRS report. I need to pass two values from the web form (User.Identity.Name and a description of the report) in addition to the three parameters built into the RDL file in SSRS. How can I send all five values into the stored procedure that is used by the RDL file?

I'm gathering the user name and report name in C# code behind during Page_Load by using

(var username = User.Identity.Name;)
(var report = "Customer Service - Get Ship Date";)

I have the report viewer, which uses an RDL file where the user will select three parameters from drop down lists.

<rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" Font-Size="8pt" ProcessingMode="Remote" WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt" Height="100%" Width="100%" SizeToReportContent="True" PageCountMode="Actual" AsyncRendering="False">
<ServerReport ReportPath="/Express/Customer Service/CSGetShipDate" ReportServerUrl="http://MMSMV-SQL1:81/ReportServer_SQL2008" />

I'm just not sure of how to combine the parameters to be sent to the report server for executing the RDL file.

Any help would be greatly appreciated.


Please do something like below to pass parameters to SSRS stored procedure.

List<ReportParameter> reportParams = new List<ReportParameter>();
reportParams.Add(new ReportParameter("SPVariable1", User.Identity.Name));
reportParams.Add(new ReportParameter("SPVariable2", Report.Description));

Ensure that you have used proper variable names. As they are case sensitive.