0
  1. In SSRS I have a parameter which is of type integer.

enter image description here

  1. Parameter values are bound from dataset, so that after the report gets loaded we can select parameter and run the report.

enter image description here

  1. My situation is I have to pass the same parameter from web app without disturbing the existing functionality. Like "1,2,3" these are Id's which exists in the dropdown.

Elaborating the issue:


I have a query in SSRS dataset which takes a parameter employeeIds (this is a multi select parameter) query is something like this where EmployeeTable.Id in (@employeeIds)

When I used SQL profiler and saw the query executed against my database, it looks like this EmployeeTable.Id in (21,34,56,81)

Which is good, all works well till here. Now I need to call same report from a ASPX page without showing SSRS Filters pane (So I have to construct my params and pass to SSRS report)

Here is how I tried to passed the parameter

parameters(10) = New ReportParameter("employeeIds", "21,34,56,81")

This is throwing error as below

Cannot cast varchar to integer

If I change my Report parameter to string that will break SSRS Parameter filter logic, so I cannot do that. Without disturbing current working SSRS report how can I pass this param from code to Report?

Any help would be highly appreciated!

  • so.. what do you have so far and what exactly are you having trouble with? – Harry Jul 02 '20 at 20:44
  • When I pass comma separated input exception occurs stating - cannot convert string to integer – Vaduganathan Jul 02 '20 at 20:50
  • what happens if you were to change the datatype to text for your parameter? – Harry Jul 02 '20 at 21:25
  • If I change it to text, no error but SSRS do not recognize and apply value. With type text and pass one value e.g."1" it works fine – Vaduganathan Jul 03 '20 at 07:17
  • @Harry please see my updated question where I have elaborated with all details. – Vaduganathan Jul 03 '20 at 07:55
  • Does this answer your question? [Passing multiple values for a single parameter in Reporting Services](https://stackoverflow.com/questions/512105/passing-multiple-values-for-a-single-parameter-in-reporting-services) – Ed Harper Jul 03 '20 at 07:59

1 Answers1

0

If I get it right you're trying to open the report in an aspx page and want to open it with your parameter employeeIds set to specific values. So you're looking into setting the parameter value of employeeIds to many values at once.

That could look like this:

parameters(10) = New ReportParameter("employeeIds", new string[] {"21","34","56","81"})

When providing multiple values to a parameter you need to put them in an Array. Have a look here for more info.

casenonsensitive
  • 955
  • 2
  • 9
  • 18