public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { OfficeDirExp rpt = new OfficeDirExp(); rpt.Site = this.Site; return(rpt); }
//direct private void DataSet(string qry) { DataTable table = new DataTable(); MySqlDataReader reader; table.Columns.Add("date", typeof(DateTime)); table.Columns.Add("first_name", typeof(string)); table.Columns.Add("Category", typeof(string)); table.Columns.Add("amount", typeof(double)); try { reader = DBConnection.getData(qry); if (reader.HasRows) { while (reader.Read()) { table.Rows.Add(reader.GetDateTime("date"), reader.GetString("first_name"), reader.GetString("Category"), reader.GetDouble("amount")); } } reader.Close(); OfficeExpensesForm.Reports.OfficeDirExp report = new Reports.OfficeDirExp(); report.Database.Tables["OffDirect"].SetDataSource(table); crystalReportViewer1.ReportSource = null; crystalReportViewer1.ReportSource = report; } catch (Exception exc) { MessageBox.Show(exc.ToString()); } }