In C# I'm trying to set the report parameters for an SSRS rdlc file. First of all, am I doing this correctly?
- GetParameters() to return a collection of the parameter info
- Create a list of new ReportParameter objects, assigning name and values
- Call SetParameters with the new ReportParameter list as the argument.
Assuming I'm handling this correctly, here's my conundrum. Code is vastly simplified for this example:
var reportParams = new List<ReportParameter>();
foreach (var param in report.GetParameters()) {
reportParams.Add(new ReportParameter(param.Name, "1"));
}
report.SetParameters(reportParams);
When the report parameter type is an integer, I get the following error on the SetParameters call:
The value provided for the report parameter 'intActualWeight' is not valid for its type.
But when I try to set the parameter value as an integer:
reportParams.Add(new ReportParameter(param.Name, 1));
The IDE says it cannot convert from int to string. Looking at the overloads for new ReportParameter, it is expecting a string or string array.
What am I doing wrong? Thanks in advance!
Steve.