Click to See Complete Forum and Search --> : "Missing parameter values" Error using subreport on VS2005 and CR


kryptos
February 20th, 2008, 08:06 AM
Hello guys, I'm trying to set parameters dinamically into a subreport using this logic:

ReportDocument report = new ReportDocument();
report.Load("Test.rpt");

ParameterFieldDefinition def = report.subreports["Footer"].DataDefinition.ParameterFieldDefinitions["MyName"];

ParameterValues currentValues = def.CurrentValues;
ParameterDiscreteValue discreteValue = new ParameterDiscreteValue();
discreteValue.Value = "Daniel";
currentValues.Add(discreteValue);
def.ApplyCurrentValues(currentValues);

It didn't work, so I've tried with this logic:

ParameterFieldDefinition def = report.subreports["Footer"].DataDefinition.ParameterFieldDefinitions["MyName"];

ParameterDiscreteValue discreteValue = new ParameterDiscreteValue();
discreteValue.Value = "Daniel";
def.Add(discreteValue);

And I'm still having the same error message.
The subreport "Footer" has only one field. I've checked the name, and it's alright.

And if I use this logic to set a report field, works.

Any ideas on how to resolve this problem???
Thanks in advance.