error in the function ParameterValueForSQL, if the value is null, there should be a test on the value.