Click here to Skip to main content
15,889,315 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
So I'm working on a crystal report that works fine.

I need to send 1 Discrete Value to the report. I use the following code and then add a parameter field with the Parameters name in it but when I run it it shows the viewer panel asking for a parameter input when I already specified its "25" and have dragged the field on the report where 25 should appear (please not its a hard-coded variable for demo purposes but will be code-side dynamic)


C#
ParameterField test;
         
test.ParameterFieldName = "TestID";
myDiscreteValue = new ParameterDiscreteValue();
int sTest = 25;
myDiscreteValue.Value = sTest;
test.CurrentValues.Add(myDiscreteValue);

reportParameters.Add(test);
Posted

1 solution

Please try with that

C#
rptMYReport objRpt = new rptMYReport ();

objRpt.SetDataSource(reportHeader);

objRpt.SetParameterValue("Parameter1", "value1");

objRpt.SetParameterValue("Parameter2", "value2");



Here,
rptMYReport is my Report

reportHeader is my DataTable.

Parameter1 && Parameter2 is your crystal report parameter that you define in your report viewr.

value1 && value2 is the value that you want to pass.
 
Share this answer
 
Comments
Md. Rashim Uddin 8-Sep-11 11:42am    
Did u try with that??
entiresol 1-Sep-12 8:02am    
I am also facing same problem, i try this solution but this is not working.

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