public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { adherentsCrystalReports rpt = new adherentsCrystalReports(); rpt.Site = this.Site; return(rpt); }
private void imprimerAdherents_Click(object sender, EventArgs e) { try { connection.Open(); DataTable adherentsTable = new DataTable(); new SqlDataAdapter($"select codAdh,nomAdh,cinAdh,dnAdh from adherents where dnAdh between" + $" '{Date_De.Text}' and '{Date_A.Text}'; ", connection).Fill(adherentsTable); adherentsCrystalReports adherentReports = new adherentsCrystalReports(); adherentReports.SetDataSource(adherentsTable); adherentReports.SetParameterValue("date_de", Date_De.Text); adherentReports.SetParameterValue("date_a", Date_A.Text); crystalReportViewer1.ReportSource = adherentReports; }catch (SqlException ex) { MessageBox.Show(ex.Message); } finally { connection.Close(); } }