Пример #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            OuvrageCrystalReport rpt = new OuvrageCrystalReport();

            rpt.Site = this.Site;
            return(rpt);
        }
 private void imprimerOuvrages_Click(object sender, EventArgs e)
 {
     try
     {
         connection.Open();
         DataTable ouvrageTable = new DataTable();
         new SqlDataAdapter("select codeOuv,titOuv,nomDit,nomAdh,dateEmp from ouvrages join emprunts on ouvrages.codeOuv = Emprunts.codOuv " +
                            "join adherents " +
                            "on adherents.codAdh = Emprunts.codAdh ", connection).Fill(ouvrageTable);
         OuvrageCrystalReport ouvrageReport = new OuvrageCrystalReport();
         ouvrageReport.SetDataSource(ouvrageTable);
         crystalReportViewer1.ReportSource = ouvrageReport;
     }
     catch (SqlException ex)
     {
         MessageBox.Show(ex.Message);
     }
     finally
     {
         connection.Close();
     }
 }