locked
Crystal Report : Parameter field is unable to work in my crystal report. RRS feed

  • Question

  • Hi Friends,

    I am trying to set the parameter values in crystal report. I tried to many things but nothing works and unfortunately it doesn't show me error. Please can any one let me help out.

    Note: This Crystal Report was made in Crystal Report 2008 version. I am using this Crystal Report in Visual Studio 2005 IDE. When I use this it display message that this crystal report is created in higher version, after that I make some small changes in Report and after saving this works fines to me. Only parameter is giving me trouble

    I tried few things.

    //Method 1:
    CrystalReport1 cr = new CrystalReport1();
    cr.SetParameterValue("ParameterName", ParameterValue);
    crystalReportViewer1.ReportSource = cr;
    crystalReportViewer1.Refresh(); 
    
    //Method 2:
    myCrystalReport.ParameterFields["Items"].CurrentValues.AddValue(item);
    
    //Method 3:
    ReportDocument rpt = new ReportDocument();
    rpt.Load(fileName);
    SetLogonParameter(rpt, credientials);
    foreach (DictionaryEntry d in ReportParameters)
    {
     ParameterFields paramFields = rpt.ParameterFields;
     ParameterField pStatus = new ParameterField();
     ParameterValues p1 = new ParameterValues();
     ParameterDiscreteValue pStatusValue = new ParameterDiscreteValue();
     pStatusValue.Value = d.Value;
     pStatus.CurrentValues.Add(pStatusValue);
    paramFields[d.Key.ToString()].CurrentValues.Add(pStatusValue);
     p1.Add(pStatusValue);         
    rpt.DataDefinition.ParameterFields[d.Key.ToString()].ApplyCurrentValues(p1);
    }
    
    Method 4:
    {
    rpt.ParameterFields["@pStatus"].CurrentValues.Add(pfItemYr);    
     CrystalDecisions.Shared.ParameterDiscreteValue p = new CrystalDecisions.Shared.ParameterDiscreteValue();
     p.Value = d.Value.ToString();
    rpt.ParameterFields[d.Key.ToString()].CurrentValues.Add(p);
     }

    Thanks in Anticaption


    Manish

    Tuesday, January 15, 2013 6:48 AM

All replies

  • Looks like you are in the completely wrong forum.


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
    Tuesday, January 15, 2013 10:48 PM
  • Is it something to do with SQL server as posted this question in o SQL server Forums? Are the parameter which are in underlying SP/query are not shown in your crystal report?

    Kindly mark the reply as answer if they help

    Wednesday, January 16, 2013 10:53 AM