Skip to Content
0
Former Member
Dec 14, 2011 at 06:14 PM

Parameter values not Staying set

33 Views

Hello All,

I have a report with 17 parameter fields. They are named "Title0", "Title1", "Title2"... "Title16".

In my code, I have a loop which sets the values from a list of values. I can set the value of my first parameter, but as soon as I set the value of the second parameter, the value of the first parameter is cleared out.

Has anyone seen this before? Is there a workaround?

Here is some sample code

string []  paramValues =SetParameterValues(); // sets the values to be used. Gets 17 strings
ReportDocument myReport = new ReportDocument();
myReport.Load(<my report path>);
for (int i = 0; i < 17; i++)
{
   string paramName = "Title" + i.ToString();
    myReport.SetParameterValue(paramName, paramValues<i>);
}

Stepping though this code in the debugger, the first time through the loop works as expected. But on the second time through the loop (i=1) the value for myReport parameter [0] is cleared out.

How should I be setting these values?

Thanks,

-tomas