We are using Crystal 2008 in VS2003. We need to assign NULL value to Crystal parameters: Boolean, Currency, Date, DateTime, Time, Number, String.
When the NULL value is assigned, the exception thrown
"The types of the parameter field and parameter field current values are not compatible."
ParameterFieldDefinitions crParameterFieldDefinitions; ParameterFieldDefinition crParameterFieldDefinition; ParameterValues crParameterValues; ParameterDiscreteValue crParameterDiscreteValue; crParameterFieldDefinitions = crReportDocument.DataDefinition.ParameterFields; crParameterFieldDefinitions.Reset(); crParameterFieldDefinition = crParameterFieldDefinitions[paramName]; // parameter Name crParameterValues = crParameterFieldDefinition.CurrentValues; crParameterValues.Clear(); crParameterDiscreteValue = new ParameterDiscreteValue(); if (paramValue == System.DBNull.Value) crParameterDiscreteValue.Value = null; else crParameterDiscreteValue.Value = paramValue; // this is object wit the parameter value entered by the user crParameterValues.Add(crParameterDiscreteValue); crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
We have a propetarian OLEDB that talks to Crystal. When NULL value is assigned, all possible values of the parameters are used in the query -that is there is no filtering based on the parameter value. On previous Crystal .NET versions and in the COM components you could set the parameter value to NULL/Nothing, now in Crystal 2008 it seems that this is not possible, however we still need this functionality.
How do we set the value to NULL in Crystal 2008?
Thanks,