public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            RptclassFeePayment rpt = new RptclassFeePayment();

            rpt.Site = this.Site;
            return(rpt);
        }
Beispiel #2
0
 private void btnPrint_Click(object sender, EventArgs e)
 {
     try
     {
         this.Hide();
         Cursor         = Cursors.WaitCursor;
         timer1.Enabled = true;
         frmclassfeepaymentReport frm = new  frmclassfeepaymentReport();
         RptclassFeePayment       rpt = new  RptclassFeePayment();
         //The report you created.
         SqlConnection  myConnection = default(SqlConnection);
         SqlCommand     MyCommand    = new SqlCommand();
         SqlDataAdapter myDA         = new SqlDataAdapter();
         ERPS_DBDataSet myDS         = new ERPS_DBDataSet();
         myConnection          = new SqlConnection(cs.DBcon);
         MyCommand.Connection  = myConnection;
         MyCommand.CommandText = "select * from CourseFeePayment,student where student.AdmissionNo=courseFeePayment.AdmissionNo and CourseFeePayment.ID= '" + txtFeePaymentID.Text + "'";
         MyCommand.CommandType = CommandType.Text;
         myDA.SelectCommand    = MyCommand;
         myDA.Fill(myDS, "CourseFeePayment");
         myDA.Fill(myDS, "Student");
         // myDA.Fill(myDS, "CourseFeePayment_join");
         rpt.SetDataSource(myDS);
         frm.crystalReportViewer1.ReportSource = rpt;
         frm.Show();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }