Why is my SSRS ReportExecutionService not recognizing my set parameter Values

0

Here is my code set up using the ReportExecutionService

ReportExecutionService rs = new ReportExecutionService();

            string format = "PDF";
            string reportPath = "/Sam - Faculty and Course Reports/Class List Report (Phase)";
            string mimeType = "application/pdf";

            ParameterValue[] parameters = new ParameterValue[3];
            parameters[0] = new ParameterValue();
            parameters[0].Label = "QuarterYear";
            parameters[0].Name = "QuarterYear";
            parameters[0].Value = "40";

            parameters[1] = new ParameterValue();
            parameters[1].Name = "Type";
            parameters[1].Value = "Admin";

            parameters[2] = new ParameterValue();
            parameters[2].Name = "PhaseID";
            parameters[2].Value = "5036";


            byte[] results = RenderReport(rs, format, mimeType, reportPath, parameters);
            WriteFile(results, FullFilePath);

  private static byte[] RenderReport(ReportExecutionService rs, string format, string mimeType, string reportPath, ParameterValue[] parameters)
        {
            rs.Credentials = System.Net.CredentialCache.DefaultCredentials;

            //Prepare Render arguments
            string historyID = null;
            string deviceInfo = String.Empty;
            string extension = String.Empty;
            string encoding = String.Empty;
            Warning[] warnings = null;
            string[] streamIDs = null;
            byte[] results = null;

            rs.LoadReport(reportPath, historyID);
            rs.SetExecutionParameters(parameters, "en-us");
            results = rs.Render(format, deviceInfo, out extension, out mimeType, out encoding, out warnings, out streamIDs);

            return results;
        } 

on the line rs.SetExecutionParameters:

I am receiving the following error: These are in the correct order, but Is the reason I am getting this error because the first Parameter "QuarterYear" as following:

enter image description here

System.Web.Services.Protocols.SoapException HResult=0x80131501 Message=This report requires a default or user-defined value for the report parameter 'QuarterYear'. To run or subscribe to this report, you must provide a parameter value. ---> Microsoft.ReportingServices.Diagnostics.Utilities.ReportParameterValueNotSetException: This report requires a default or user-defined value for the report parameter 'QuarterYear'. To run or subscribe to this report, you must provide a parameter value. Source=System.Web.Services StackTrace: at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) at MyServices.MyReportSerivce.ReportExecutionService.Render(String Format, String DeviceInfo, String& Extension, String& MimeType, String& Encoding, Warning[]& Warnings, String[]& StreamIds) in c:\users\prykiel\source\repos\Factodo399\MyServices\Web References\MyReportSerivce\Reference.cs:line 633 at Factodo399.Program.RenderReport(ReportExecutionService rs, String format, String mimeType, String reportPath, ParameterValue[] parameters) in c:\users\prykiel\source\repos\Factodo399\Factodo399\Program.cs:line 65 at Factodo399.Program.CreateSSRSPDF() in c:\users\prykiel\source\repos\Factodo399\Factodo399\Program.cs:line 46 at Factodo399.Program.Main(String[] args) in c:\users\prykiel\source\repos\Factodo399\Factodo399\Program.cs:line 16

c#
reporting-services

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0