Having problem resending parameter to report

  • Using SSRS2005, VS2005 (C#). Using Server Reports.

    Report has two parameters, which allow nulls. Default for the two parameters

    is null. Report runs fine when viewing report initially with null parameters.

    Select a non-null value for either/both parameters. Report re-runs fine.

    Set parameters back to null. Report re-runs for last selected non-null value

    for that parameter.

    ie:

    All (null)

    A (a)

    B (b)

    When All is initially selected, get both A & B.

    When A is selected, get A.

    When B is selected, get B.

    When All is selected again, get B.

    When A is selected, get A.

    When All is selected again, get A.

    null values are being set as:

    Param[0] = new ReportParameter("Section");

    non-null values are being set as:

    Param[0] = new ReportParameter("Section", SectionValue);

    Param array is then passed to a RunReport routine:

    rvwReport.ProcessingMode = ProcessingMode.Remote;

    rvwReport.ServerReport.ReportServerUrl = new Uri(reportServerUrl);

    reportPath = reportPath + reportName;

    rvwReport.ServerReport.ReportPath = reportPath;

    rvwReport.ServerReport.SetParameters(reportParameters);

    rvwReport.RefreshReport();

    What has to be done to get the correct (null) value in there?

    By tracing our code, we are putting a null in the parameter. But the report

    isn't using it.

    Thanks,

    Wayne

    Wayne
    Microsoft Certified Master: SQL Server 2008
    Author - SQL Server T-SQL Recipes


    If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
    Links:
    For better assistance in answering your questions
    Performance Problems
    Common date/time routines
    Understanding and Using APPLY Part 1 & Part 2

  • Resolution:

    when setting the parameter specifically to null, do it as:

    Param[0] = new ReportParameter("Section", new string[] {null});

    Wayne
    Microsoft Certified Master: SQL Server 2008
    Author - SQL Server T-SQL Recipes


    If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
    Links:
    For better assistance in answering your questions
    Performance Problems
    Common date/time routines
    Understanding and Using APPLY Part 1 & Part 2

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply