Results 1 to 4 of 4

Thread: Parameters

  1. #1

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

    Parameters

    I am using vs2005 (c#), and i am calling a report in crystal.
    I have a parameter fields (@secuencia) and i want to print only those records with that criteria. So i have to create (i think) the following:
    Report --->Selection Formula --> Record and :{v_reportes.secuencia}=@secuencia, where @secuencia is the parameters.

    To me this is ok, but crystal says: missing ")".
    If i use:{v_reportes.secuencia}=7 Where 7 is a secuencia, works!


    what i'm doing wrong?

  2. #2
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    Re: Parameters

    plz post the code where you're passing the parameter.

  3. #3

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

    Re: Parameters

    private void Procesarreporte()
    {
    CrystalDecisions.Shared.ParameterValues pvCollection = new CrystalDecisions.Shared.ParameterValues();
    CrystalDecisions.Shared.ParameterDiscreteValue pdvCustomerName = new CrystalDecisions.Shared.ParameterDiscreteValue();

    ReportDocument rptticket = new ReportDocument();

    try
    {
    rptticket.Load(@"..\..\rptticket.rpt");
    pdvCustomerName.Value = gTicket;
    pvCollection.Add(pdvCustomerName);

    rptticket.SetParameterValue("@secuencia", gTicket);
    rptticket.DataDefinition.ParameterFields["@Secuencia"].ApplyCurrentValues(pvCollection);

    /* foreach(CrystalDecisions.CrystalReports.Engine.Table tbCurrent in rptcuentaespecifica.Database.Tables)
    {
    tliCurrent = tbCurrent.LogOnInfo;
    //tliCurrent.ConnectionInfo.ServerName = "sqlserv01";
    //tliCurrent.ConnectionInfo.UserID = string.Empty;
    //tliCurrent.ConnectionInfo.Password = string.Empty;
    tliCurrent.ConnectionInfo.DatabaseName = "Caja";
    //tbCurrent.ApplyLogOnInfo(tliCurrent);
    } */
    crvBasic.ReportSource = rptticket;
    crvBasic.Zoom(2);
    crvBasic.Visible = true;
    }
    catch (LoadSaveReportException Exp)
    {
    MessageBox.Show(Exp.Message, this.Text);

    MessageBox.Show("No se encuentra la ruta y/o el reporte para ser ejecutado.", "Error");

    }
    catch (Exception Exp)
    {
    MessageBox.Show(Exp.Message, "General Error");
    }

    }

    and in crystal report i have created a formula in order to recieved the parameter, but crystal says it is wrong. This is the formula: :{v_reportes.secuencia}=@secuencia, where @secuencia is a parameter

  4. #4
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    Re: Parameters

    Try replacing your parameter code with something like this:

    rptticket.SetParameterValue("@secuencia", gTicket)

    that is all you really need to pass a parameter over to your CR.

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