Passing Multiple Parameter in crystal reports from VB.Net

Go To StackoverFlow.com

0

How to pass multiple parameters in crystal report from VB.Net

i want to pass 3 parameters (i have created the same in crystal report design view)

parameter names are: vBranchCode, vFromDate and vToDate

note: vfromdate and vToDate is for getting records between two date

How to do this? Please help me. regards, Sensa

2012-04-03 20:30
by Sensa


1

private void Page_Load(object sender, System.EventArgs e)
{
    if(!IsPostback)
    {
        CrystalReportViewer1.DataBind();
        SetParameterFields("vBranchCode", "branch code");        
        SetParameterFields("vFromDate", "Some Date");
        SetParameterFields("vToDate", "Some Date");
        CrystalReportViewer1.RefreshReport();
    }
}

protected void SetParameterField (string paramName, string paramValue)
{
    ParameterField pfield = CrystalReportViewer1.ParameterFieldInfo[paramName];
    ParameterDiscreteValue pval = new ParameterDiscreteValue();
    pval.Value = paramValue;
    pfield.CurrentValues.Add(pval); 
}
2012-04-06 14:15
by Justin