private void loadReport() { //Create object of report rptOlResult objReport = new rptOlResult(); //set database login information conn = new SqlConnection(cs.DBconn); //write formula to pass parameters to report //creating an object of ParameterField class ParameterField paramField = new ParameterField(); //creating an object of ParameterFields class ParameterFields paramFields = new ParameterFields(); //creating an object of ParameterDiscreteValue class ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue(); //set the parameter field name paramField.Name = "StudentID"; //set the parameter value paramDiscreteValue.Value = txtStudentID.Text; //add the parameter value in the ParameterField object paramField.CurrentValues.Add(paramDiscreteValue); //add the parameter in the ParameterFields object paramFields.Add(paramField); //set the parameterfield information in the crystal report crystalReportViewer1.ParameterFieldInfo = paramFields; crystalReportViewer1.ReportSource = objReport; }
public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { rptOlResult rpt = new rptOlResult(); rpt.Site = this.Site; return(rpt); }