Пример #1
0
        private void LoadLeaveReport()
        {
            SqlConnection conn = new SqlConnection(this.connectionString);
            SqlCommand comm = new SqlCommand("SELECT *FROM LeaveForm ORDER BY LeaveFrom DESC", conn);

            SqlDataAdapter adap = new SqlDataAdapter();
            LeaveReportDataSet dataset = new LeaveReportDataSet();
            LeaveCrystalReport crp = new LeaveCrystalReport();

            try
            {
                conn.Open();
                adap.SelectCommand = comm;
                adap.Fill(dataset, "DataTable1");
                crp.SetDataSource(dataset);
                crystalReportViewer1.ReportSource = crp;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
            finally
            {
                conn.Close();
            }
        }
Пример #2
0
 public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
 {
     LeaveCrystalReport rpt = new LeaveCrystalReport();
     rpt.Site = this.Site;
     return rpt;
 }