I'm trying to figure out how you send/set the report variables when using the ReportingService.Render method.
I can get the ReportParameters array using GetReportParameters but can't seem to find a way to populate the ParameterValue array that is passed as a variable in the Render method. I've tried creating an ArrayList comprised of ParameterValue objects (non-array), adding them to the ArrayList, and trying to convert that to a ParameterValue array. The example code I found is in VB.NET and looks like this:
reportParametersArray = rs.GetReportParameters(reportPath, Nothing, True, _
reportParameterValuesArrayList.ToArray(GetType(ParameterValue)), Nothing)
I tried to do the same thing in C#:
rpReportParams = rsReports.GetReportParameters(sReportPath, null, true, arrayListParams.ToArray(System.Type.GetType(ParameterValue)), dscCredentials);
The compile error is :
'ReportService.ParameterValue' denotes a 'class' where a 'variable' was expected
Putting quotes around ParameterValue returns the following error:
Argument '4': cannot convert from 'System.Array' to 'ParameterValue[]'
Anyone had success populating report parameters or have a suggestion?
Thanks,
O.
If arrayListParams is an ArrayList that contains ParameterValue objects, try this in C#(ParameterValue[])arrayListParams.ToArray(typeof(ParameterValue))
No comments:
Post a Comment