I have a crystal report which calls a stored proc with a number of parameters.
There are a number of dropdowns that the users can pick the parameters from.
When the report is refreshed the values of the dropdowns are then loaded into the reportDocument via the reportDocument.SetParamete
rValue method AND into the reportViewers ParameterFields collection thru a convoluted method using parameterFields and DiscreteFieldValue objects.
(If I only set the parameters in one place I got annoying missing parameter message, so not I set them in both the reportViewer and the reportDocument.)
Now the problem is that crystal is calling the SP twice, once with the wrong number of parameters. From SQL profiler:
exec "HUBB_OPS_01"."dbo"."cmsRe
portEventS
alesSel";1
NULL, NULL, NULL, '', NULL
There should be 6 parameters not 5. The CR engine calls the SP again straight away with the right parameters
exec "HUBB_OPS_01"."dbo"."cmsRe
portEventS
alesSel";1
NULL, NULL, NULL, NULL, '', NULL
Now the problem is that when I try to set the 5th varchar parameter crystal make the following call to the DB :
exec "HUBB_OPS_01"."dbo"."cmsRe
portEventS
alesSel";1
NULL, NULL, NULL, 'United States', NULL
This call crashes the report page because 'United States' cannot be converted to int (the 4th parameter). I have a feeling that if this didnt cause an error crystal would call the sp again with the correct parameters.
Any ideas ? This is a stupid CR bug, one of the many thousands! I should have saved myself the trouble and written the reports by hand, however they are 95% complete and it seems a shame to throw it away because of something dumb like this.
Start Free Trial