1447553 - Errors when using the Crystal Reports SDK for VS .NET and setting the value of a parameter to Null

SAP Knowledge Base Article - Public

1447553 - Errors when using the Crystal Reports SDK for VS .NET and setting the value of a parameter to Null

Symptom

  • Using code as described in kbase #1425379
  • Setting a parameter to NULL the following error is produced:
{System.ArgumentException: One or more arguments are invalid. at CrystalDecisions.Enterprise.Desktop.ISReportParameterSingleValue.set_Value(String pbstrVal) 
at CrystalDecisions.Enterprise.Desktop.ReportParameterSingleValue.set_Value(String value) at UpdateDB.Program.Main(String[] args)}

Environment

  • Crystal Reports 2008, SP2
  • Visual Studio .NET 2008

Reproducing the Issue

Both of the below lines of code produce the same error:

 parameterSingleValue.SingleValue.Value = "null";
 parameterSingleValue.SingleValue.Value = "";

Resolution

Use the following code:

parameterSingleValue.SingleValue.IsNull = true;

Keywords

Forum thread , KBA , BI-DEV-NET-SDK , .NET SDK / COM SDK , How To

Product

Crystal Reports 2008 V0 ; Crystal Reports 2008 V1 ; SAP Crystal Reports 10.0 ; SAP Crystal Reports 2011 ; SAP Crystal Reports XI ; SAP Crystal Reports XI R2