Click here to Skip to main content
15,880,796 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
What is the best way of passing more than 1 parameter via VB.Net to a Crystal Report.

At the moment I can pass 1 parameter e.g.

ParameterField.ParameterFieldName = "Country"
ParameterValue.Value = "England"
ParameterField.CurrentValues.Add(ParameterValue)
ParamFields.Add(ParameterField)


What I want is the above plus say Capital e.g. "London"

So the parameters going into the Crystal Report would be England & London

How is this done?


[Edited]Code is wrapped in "pre" tags[/Edited]
Posted
Updated 8-Aug-11 5:04am
v2

There is no reason why a Crystal Report can't have more than one parameter. Just add another parameter field to the report and place it on the report where you want it, then copy the code you have in your question and edit it with the new parameter's field name and value in order to set it. If that's not what you are having trouble with, please be more specific about what is causing problems.
 
Share this answer
 
Agree with Kschuler.

Why don't you send the value "England & London" to the parameterfield Country?

Or otherwise go with his idea. Create two parameter fields Country & City & send the values England & London to those parameter fields. In report create a formula field to concatenate these two values & display.

And another thought is, you are going to select data based on these two values(England & London), for that you may build selectionformula dynamically & you can send it to report.
C#
CrystalReportViewer.selectionFormula = "{Table.Country} = 'England'  Or {Table.City} = 'London'" 


If still not clear, please let us know.
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900