Results 1 to 2 of 2

Thread: crystal report error passing parameter

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Sep 1999
    Location
    Santo Domingo,D.N., Dom. Rep.
    Posts
    707

    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

  2. #2
    Frenzied Member mar_zim's Avatar
    Join Date
    Feb 2004
    Location
    Toledo Cebu City.
    Posts
    1,416

    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);
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width