?
Solved

Discrete Parameter not Working with .NET  (C#)

Posted on 2005-03-24
6
Medium Priority
?
523 Views
Last Modified: 2012-08-14
Hi Experts,

Hi have a form that is made of a Crystal Report Viewer, and I'm trying to load a report into it.
The report loads, but witouth the Parameter field set to the value I assign in the code ... And if I hit Refresh, it will prompt me for the Discrete Value ...


Here's the code I use :

public ShippingReportViewer()
            {
                  //
                  // Required for Windows Form Designer support
                  //
                  InitializeComponent();

                  //Create an instance of the strongly-typed report object
                  crReportDocument = new FulFill();
                  
                  //Get the collection of parameters from the report
                  crParameterFieldDefinitions = crReportDocument.DataDefinition.ParameterFields;
           
                  //Access the specified parameter from the collection
                  crParameterFieldDefinition = crParameterFieldDefinitions["EventID"]; //This is the parameter in the report, a Number

                  //Get the current values from the parameter field.  At this point
                  //there are zero values set.
                  crParameterValues = crParameterFieldDefinition.CurrentValues;

                  //Set the current values for the parameter field
                  crParameterDiscreteValue = new ParameterDiscreteValue();
                  crParameterDiscreteValue.Value = 166; //I know, it's static, but its to test !!!

                  //Add the first current value for the parameter field
                  crParameterValues.Add(crParameterDiscreteValue);

                  //All current parameter values must be applied for the parameter field.
                  crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);

                  //Set the viewer to the report object to be previewed.
                  crystalRV.ReportSource = crReportDocument;
            }
0
Comment
Question by:Francis_B
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 34

Expert Comment

by:Brian Crowe
ID: 13623481
try...

crReportDocument.SetParameterValue("EventID", 166)
0
 

Author Comment

by:Francis_B
ID: 13623671
Hi BriCrowe,

hum.. this command does not exist when I type crReportDocument ... can it be a version problem?

Thanks,

Francis
0
 
LVL 101

Accepted Solution

by:
mlmcc earned 2000 total points
ID: 13623755
Check the report for SAVED DATA

Open the report
Click FILE
Ensure SAVE DATA WITH REPORT is not checked.

mlmcc
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Author Comment

by:Francis_B
ID: 13623825
mlmcc - I have both Crystal Reports 9.2 and the version included in .NET ... Now this report has been created directly in .NET,
but I noticed that the VERSION property of the CRYSTALREPORTS.ENGINE reference is 9.2.3 ... Can it affect something?

- I will try the SAVE DATA WITH REPORT not checked issue now, using the CrystalReports 9.2.3 (this is not availlable in CrystalReport .NET, I think ...)

Thanks for your help
0
 

Author Comment

by:Francis_B
ID: 13624357
... and you were RIGHT !!! The SAVE DATA WITH REPORT was checked !

Great ! I can now call this report with the associated Event ID !

Thanks alot mlmcc, this was a tricky one ! (well.....for me!)

Francis.
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 13626685
I bet SAVE DATA WITH REPORT is the default.  To change that
Open Crystal with no report
Click FILE --> OPTIONS
Uncheck the SAVE DATA WITH REPORT option

Glad i could help

mlmcc
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question