Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing null values for parameters #56

Open
aaronm32 opened this issue Dec 30, 2021 · 1 comment
Open

Passing null values for parameters #56

aaronm32 opened this issue Dec 30, 2021 · 1 comment

Comments

@aaronm32
Copy link

aaronm32 commented Dec 30, 2021

I have a crystal report that runs a stored procedure. When running the report through CR 2008 (v.12.0.0.683) the each parameter prompt has the option for "Set to Null". However, when I leave out the value when passing parameters to Crystal Reports Ninja, it returns the error:

Message: Length cannot be less than zero.
Parameter name: length
HResult: -2146233086
Data: System.Collections.ListDictionaryInternal
Inner Exception:
StackTrace:    at System.String.Substring(Int32startIndex, Int32 length)
   at CrystalReportsNinja.ParameterCore.ProcessRawParameters()
   at CrystalReportsNinja.ReportProcessor.ProcessParameters()
   at CrystalReportsNinja.ReportProcessor.Run()

Additional information: Database is SQL Anywhere v16 and the parameters are type LONG VARCHAR DEFAULT NULL. An empty string '' value is treated differently than value NULL passed to the stored procedure. For example, calling myProc('','','') will return a database error, however, when 'Set to Null' is checked in Crystal Reports it calls using myProc(NULL,NULL,NULL) and that works.

Is there anyway to pass null values to the required parameters?

@aaronm32
Copy link
Author

aaronm32 commented Jan 4, 2022

Had some time today to look at this and added simple code changes to ParameterCore.cs to make it convert the empty strings into null values. https://github.com/aaronm32/CrystalReportsNinja/tree/NullParameters-Fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant