Error while downloading the ssrs report with multiple parameters (e.g. JOB_NUMBER and PO_No) RRS feed

  • Question

  • User1587720337 posted

    Problem: Getting the following error when I am trying to download the report which has multiple parameters, it's seems to be working fine with report which has one parameter or no parameter.

    Error Message: System.Web.Services.Protocols.SoapException: This report requires a default or user-defined value for the report parameter 'PO_No'. To run or subscribe to this report, you must provide a parameter value. --->

    Source Code:

    ReportExecutionService rs = new ReportExecutionService();
    rs.Credentials = CredentialCache.DefaultCredentials;
    rs.Url = "http://localhost/reportserver/reportexecution2005.asmx";
    rs.ExecutionHeaderValue = new ExecutionHeader();
    var executionInfo = new ExecutionInfo();
    executionInfo = rs.LoadReport("/slReport/PO_wOutPrices", null);

    List<ParameterValue> parameters = new List<ParameterValue>();
    parameters.Add(new ParameterValue { Name = "JOB_NUMBER", Value = "1823" });
    parameters.Add(new ParameterValue { Name = "PO_No", Value = "002" });
    rs.SetExecutionParameters(parameters.ToArray(), "en-US");
    string deviceInfo = "<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>";
    string mimeType;
    string encoding;
    string[] streamId;
    Warning[] warning;

    var result = rs.Render("PDF", deviceInfo, out mimeType, out encoding, out encoding, out warning, out streamId);
    File.WriteAllBytes("d:\\SLReports\\report.pdf", result);

    Any ideas how to fix this?

    Tuesday, January 1, 2019 4:56 PM

All replies

  • User-1174608757 posted

    Hi Srishti Bharti,


    parameters.Add(new ParameterValue { Name = "PO_No", Value = "002" });

    According to your description,It is obvious that you have set this PO_No as a data of string, I suggest you to check the type of column in database. If the data type is int , it will throw similar  exception when you add parameters type of string .

    Here is the link ,I hope it can help you.


    Best Regards

    Wei Zhang

    Wednesday, January 2, 2019 9:19 AM