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
borg48Asked:
Who is Participating?
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.