crystal report error passing parameter
What i am doing wrong?
I have a report with two(2) tables and a parameter field.
On my app i have the following (according to microsoft 101C# samples:Windows forms: Using Crystal Reports)
Code:
CrystalDecisions.Shared.ParameterValues pvCollection =new CrystalDecisions.Shared.ParameterValues();
CrystalDecisions.Shared.ParameterDiscreteValue pdvCustomerName = new CrystalDecisions.Shared.ParameterDiscreteValue();
ReportDocument rptcuentaespecifica =new ReportDocument();
try
{
rptcuentaespecifica.Load(@"..\..\rptespecifica.rpt");
pdvCustomerName.Value = cbofilename.Text;
pvCollection.Add(pdvCustomerName);
rptcuentaespecifica.DataDefinition.ParameterFields["@Descripcion"].ApplyCurrentValues(pvCollection);
crvBasic.ReportSource = rptcuentaespecifica;
crvBasic.Zoom(2);
}
but nothing works. The report bring me all data on the table and i just want the one selected on cbofilename.text
How do i pass a parameter to a report?
Any help
Re: crystal report error passing parameter
Try instantiating your report document.
Code:
CrystalDecisions.Shared.ParameterValues pvCollection =new CrystalDecisions.Shared.ParameterValues();
CrystalDecisions.Shared.ParameterDiscreteValue pdvCustomerName = new CrystalDecisions.Shared.ParameterDiscreteValue();
rptespecifica rpt=new rptespecifica();
try
{
pdvCustomerName.Value = cbofilename.Text;
pvCollection.Add(pdvCustomerName);
rpt.DataDefinition.ParameterFields["@Descripcion"].ApplyCurrentValues(pvCollection);
crvBasic.ReportSource = rpt;
crvBasic.Zoom(2);
}