SSRS Parameter

Long 1 Reputation point
2020-10-08T08:46:28.043+00:00

Hi,

I just started to use migrating to SSRS Version 15.0.1102.675 from Version 9.00.3073.00. In 9.00, I can just declare the parameter for the report and use @selectedYear in the sql statement but in the new version I keep getting an error "Query execution failed for dataset 'DataSet1'. Must declare the scalar variable @selectedYear".

I found if I use "?" and set up the parameter name as "?" and parameter value as @selectedYear in the Dataset Properties, the query works.

I would prefer to use the parameter in the sql query instead of using a "?". How can I do that? I've searched all over but can only find examples of using the parameter in the sql query instead of using "?"

Thank you

SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
2,913 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Olaf Helper 44,296 Reputation points
    2020-10-08T10:26:23.277+00:00

    Regarding parameter handling nothing has changed between the version and which parameter type to use depends on the used data provider, not on SSRS version.

    Have you changed the data provider? Which one are you using?

    0 comments No comments

  2. ZoeHui-MSFT 36,116 Reputation points
    2020-10-09T05:40:37.77+00:00

    Hi @Long ,

    I agree with Olaf's opinion, the SSRS version should not affect the the parameter.

    Could you please share the simple query with us so that we could do more test.

    Regards,

    Zoe


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.