private void button10_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor         = Cursors.WaitCursor;
                timer1.Enabled = true;
                RptClassFeePaymentsReport rpt = new RptClassFeePaymentsReport();
                //The report you created.
                SqlConnection  myConnection = default(SqlConnection);
                SqlCommand     MyCommand    = new SqlCommand();
                SqlDataAdapter myDA         = new SqlDataAdapter();
                ERPS_DBDataSet myDS         = new ERPS_DBDataSet();
                //The DataSet you created.


                myConnection          = new SqlConnection(cs.DBcon);
                MyCommand.Connection  = myConnection;
                MyCommand.CommandText = "select *  from CourseFeePayment,Student where Student.Admissionno=CourseFeePayment.AdmissionNo and PaymentDate between @date1 and @date2 order by PaymentDate";
                MyCommand.Parameters.Add("@date1", SqlDbType.DateTime, 30, "PaymentDate").Value = PaymentDateFrom.Value.Date;
                MyCommand.Parameters.Add("@date2", SqlDbType.DateTime, 30, "PaymentDate").Value = PaymentDateTo.Value.Date;

                MyCommand.CommandType = CommandType.Text;
                myDA.SelectCommand    = MyCommand;
                myDA.Fill(myDS, "CourseFeePayment");
                myDA.Fill(myDS, "Student");
                rpt.SetDataSource(myDS);

                crystalReportViewer3.ReportSource = rpt;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            RptClassFeePaymentsReport rpt = new RptClassFeePaymentsReport();

            rpt.Site = this.Site;
            return(rpt);
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if (AdmissionNo.Text == "")
            {
                MessageBox.Show("Please select Admission no.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                AdmissionNo.Focus();
                return;
            }

            try
            {
                Cursor         = Cursors.WaitCursor;
                timer1.Enabled = true;
                RptClassFeePaymentsReport rpt = new RptClassFeePaymentsReport();
                //The report you created.
                SqlConnection  myConnection = default(SqlConnection);
                SqlCommand     MyCommand    = new SqlCommand();
                SqlDataAdapter myDA         = new SqlDataAdapter();
                ERPS_DBDataSet myDS         = new  ERPS_DBDataSet();
                //The DataSet you created.


                myConnection          = new SqlConnection(cs.DBcon);
                MyCommand.Connection  = myConnection;
                MyCommand.CommandText = "select *  from CourseFeePayment,Student where CourseFeePayment.AdmissionNo=Student.AdmissionNo and CourseFeePayment.AdmissionNo= '" + AdmissionNo.Text + "'order by PaymentDate";

                MyCommand.CommandType = CommandType.Text;
                myDA.SelectCommand    = MyCommand;
                myDA.Fill(myDS, "CourseFeePayment");
                myDA.Fill(myDS, "Student");
                rpt.SetDataSource(myDS);

                crystalReportViewer2.ReportSource = rpt;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }