public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { rptStudentAttendance rpt = new rptStudentAttendance(); rpt.Site = this.Site; return(rpt); }
private void btnStudentReport_Click(object sender, EventArgs e) { if (datagridview1.RowCount > 0) { string Session = Convert.ToString(Connection.GetExecuteScalar("Select sessionname from tbl_session where sessioncode='" + school.CurrentSessionCode + "'")); DataSet ds = Connection.GetDataSet("SELECT schoolname, schooladdress, schoolcity, schoolphone, affiliate_by, principal, registrationno, logoimage ,'" + Session + "' as Session FROM tbl_school "); ds.Tables.Add(Connection.GetDataTableFromDataGridView(datagridview1)); ds.WriteXmlSchema(@"" + Connection.GetAccessPathId() + @"Barcodes\a\StudentAttendance.xsd"); rptStudentAttendance cr = new rptStudentAttendance(); cr.PrintOptions.PaperOrientation = PaperOrientation.Portrait; cr.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperLetter; cr.SetDataSource(ds); ShowAllReports s = new ShowAllReports(); s.crystalReportViewer1.ReportSource = cr; cr.SetParameterValue("ReportTitle", "Student Attendance For Class : " + valcmbclass.Text); s.Show(); } else { MessageBox.Show("Please Check Student Record.", "", MessageBoxButtons.OK); } }