SAP Knowledge Base Article - Public

1214841 - How to pass a NULL parameter value at runtime using Visual Studio .NET

Symptom

  • An application uses Crystal Reports for Visual Studio .NET as the reporting development tool. 
  • The application uses a report based on a Microsoft SQL Server 2000 stored procedure that accepts NULL parameter values.
  • How do you pass a NULL value to a stored procedure parameter?

 

Resolution

  • To pass a NULL value to a stored procedure parameter, set the 'Value' property of the ParameterDiscreteValue class to NULL/Nothing. For example: 

[VB.NET sample code]

Dim crParameterDiscreteValue As New CrystalDecisions.Shared.ParameterDiscreteValue()
crParameterDiscreteValue.Value = Nothing

[C# sample code]

CrystalDecisions.Shared.ParameterDiscreteValue crParameterDiscreteValue;
crParameterDiscreteValue = new CrystalDecisions.Shared.ParameterDiscreteValue();
crParameterDiscreteValue.Value = null;

Keywords

DOTNET .NET PARAMETER NULL VBNULL EMPTY STOREDPROCEDERE SP ENGINE VB.NET Crystal Reports for Visual Studio Stored Procedure Parameters Passing NULL values , c2011736 , KBA , BI-DEV-NET-SDK , .NET SDK / COM SDK , How To

Product

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