Link to home
Start Free TrialLog in
Avatar of wint100
wint100Flag for United Kingdom of Great Britain and Northern Ireland

asked on

How can I pass multiple parameter values to Reporting Services Report c#

I have the code below to programatically render a report in Reporting Services 2008 and pass the parameters needed.

One of the parameters can accept multiple values. How can I pass these from the C# code? I've tried passing Comma seperated values (1, 2, 2 etc), but is throws an exception.

The parameters are selected from an SQL database in varchar(50) format.
if (_parameters.Length > 0)
                {
                  parameters[0] = new BECScheduler.rsExecService.ParameterValue();
                  parameters[0].Label = "";
                  parameters[0].Name  = "SDate"; 
                  parameters[0].Value = sDate;
                  parameters[1] = new BECScheduler.rsExecService.ParameterValue();
                  parameters[1].Label = "";
                  parameters[1].Name = "EDate";
                  parameters[1].Value = eDate;
                  parameters[2] = new BECScheduler.rsExecService.ParameterValue();
                  parameters[2].Label = "";
                  parameters[2].Name = "TLInstance1";
                  parameters[2].Value = TLInstance1;
                  parameters[3] = new BECScheduler.rsExecService.ParameterValue();
                  parameters[3].Label = "";
                  parameters[3].Name = "TLInstance2";
                  parameters[3].Value = TLInstance2; 
                }

Open in new window

Avatar of jinal
jinal
Flag of India image

Hello ,

You can set Values property.


This linkj give you more detail.
http://msdn.microsoft.com/en-us/library/ms251764(VS.80).aspx
Avatar of Rob Farley
How did you try passing in the list?

Like this?

(and for the record - I haven't had to do this before, but I'm just thinking about how SSRS understands multivalue parameters)

parameters[3] = new BECScheduler.rsExecService.ParameterValue();
parameters[3].Label = "";
parameters[3].Name = "TLInstance2";
parameters[3].Value = "1, 2, 3";

Avatar of wint100

ASKER

Yes thats right, with comma then a space before the next value.
ASKER CERTIFIED SOLUTION
Avatar of Rob Farley
Rob Farley
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial