Skip to Content
0
Former Member
Feb 24, 2009 at 11:34 AM

Error "One or more arguments are invalid." when setting range parameter val

81 Views

I have a report template which has a field of type Date. It has the following settings-

Allow Custom Values=true

Allow Multiple Values = true

Allow Discrete Values=true

Allow Range Values=true

I set the range value using the code as following-

ReportParameters reportParameters = report.ReportParameters;

foreach (ReportParameter reportParameter in reportParameters)
{
    ReportParameterRangeValue reportParameterRangeValue = reportParameter.CreateRangeValue();
    ReportParameterSingleValue fromParameter = reportParameterRangeValue.FromValue;
    fromParameter.Value = "2009-12-31";
}

However, this throws the foll. exception at the line fromParameter.Value = "2009-12-31";-

"One or more arguments are invalid."

" at CrystalDecisions.Enterprise.Desktop.ISReportParameterSingleValue.set_Value(String pbstrVal)\r\n at CrystalDecisions.Enterprise.Desktop.ReportParameterSingleValue.set_Value(String value)

Any ideas why? I am really perplexed as to why this should throw an exception. Is there another way to set Date type params?