2
Answers

Why we should clear off the ParameterValues after asign a paramter values to "ParameterValues" collection in crystal reports!

Ask a question
petre ricardo

petre ricardo

14y
1.8k
1
 
ParameterFieldDefinitions paraFieldDefinitions;
ParameterFieldDefinition paraFieldDefinition;
ParameterValues paraVals = new ParameterValues();


ParameterDiscreteValue paraDiscreatValue = new ParameterDiscreteValue();
 
paraDiscreatValue.Value = tbxCustomerName.Text;


paraFieldDefinitions = rptDoc.DataDefinition.ParameterFields;
 
paraFieldDefinition = paraFieldDefinitions[
"customerName"];
 
//could "customerName" field parameter hold more than one value?
paraVals = paraFieldDefinition.CurrentValues;

 
//why we clear this? this will clear off the values that was assigned from the
//previouse line.
paraVals.Clear();
 
//add the parameter values to the collection
paraVals.Add(paraDiscreatValue);
 
//what happense here?
paraFieldDefinition.ApplyCurrentValues(paraVals);

 
Hi, i have included all my question under comments, they are few issues related to crystal reports, use of paramters!
TY

Answers (2)