Crystal Reports Parameters in Visual Studio 2005
I ran into an oddity while converting an ASP.NET 1.1 project to ASP.NET 2.0 today. The conversion when was going along way too smoothly when I started testing some Crystal Reports that are processed in the web site.
This particular site runs reports based on user input, exports them to PDF format, and then displays the PDF for the users. In running them after the update, I was getting an argument exception when the program executed the export method of the Crystal Report Document object, "Missing Parameters".
Now, to paint the picture properly, I had just listened to the a href="http://hanselminutes.com/default.aspx?showID=19"latest Hanselminutes podcast on the way in to work which covered a fairly major debugging process. I had this in the back of my mind the whole time I'm trying to figure out what was going on.
My report does have a parameter so I checked my syntax to make sure the new object model still supported my method. It appeared fine, but since there are a few ways to add parameters I decided to try the method explained on in the MSDN documentation. Same result.
After a bit more head scratching and a third method of adding a parameter value, I finally discovered, that my report document was flushing the parameter I set when I connected my data source.
As I mentioned before, the process worked fine in 1.1 setting the parameter values and then attaching the data source, but in 2.0, that is no longer the case. Setting the parameters (any of the 3 ways) after connecting the data source worked great.