• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 233
  • Last Modified:

Crystal reports and ParameterValues

I'm trying to figure out how to add to parameters to the crystal report document:

Here is what i have for an individual:
                        ParameterValues myparameterValues = new ParameterValues();
                        
                        ParameterDiscreteValue myparamDiscreteValue = new ParameterDiscreteValue();            
                        myparamDiscreteValue.Value = _ApplicationId;
                        myparameterValues.Add(myparamDiscreteValue);
                        
                        document.DataDefinition.ParameterFields["@Appid"].ApplyCurrentValues(myparameterValues);      


But i have two parameters to pass:
1.  @AppId
2.  @Account

How would you do this?

Thanks in advance
0
borg48
Asked:
borg48
1 Solution
 
YurichCommented:
as far as i know, you'll have to pass'em all individually...

create  a function for passing parameters, say something like

      private void SetCrystalReportParameters( string fieldName, string parameterValue )

and call it everytime you need to pass parameters

you may want to create an array of parameters and then just call your function withing foreach statement

regards
0
 
mhertzDEVCommented:
Hello:

Its just like if you were to called a Store Procedure from SQL you have to call them individually and it will append them at the end.. so your code will look like this:

                    ParameterValues myparameterValues = new ParameterValues();
                   
                    ParameterDiscreteValue myparamDiscreteValue = new ParameterDiscreteValue();          
                    myparamDiscreteValue.Value = _ApplicationId;
                    myparameterValues.Add(myparamDiscreteValue);
                   
                    document.DataDefinition.ParameterFields["@Appid"].ApplyCurrentValues(myparameterValues);  
                    document.DataDefinition.ParameterFields["@Account"].ApplyCurrentValues(myparameterAccountValues);  
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now