public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { ProjectRepot1 rpt = new ProjectRepot1(); rpt.Site = this.Site; return(rpt); }
private void DataSet(string qry) { DataTable table = new DataTable(); MySqlDataReader reader; table.Columns.Add("proj_id", typeof(Int32)); table.Columns.Add("proj_name", typeof(string)); table.Columns.Add("description", typeof(string)); table.Columns.Add("name", typeof(string)); table.Columns.Add("first_init_date", typeof(DateTime)); table.Columns.Add("warranty_start_date", typeof(DateTime)); table.Columns.Add("warranty_period", typeof(int)); table.Columns.Add("event_id", typeof(Int32)); table.Columns.Add("amount", typeof(double)); try { reader = DBConnection.getData(qry); if (reader.HasRows) { while (reader.Read()) { table.Rows.Add(reader.GetInt32("proj_id"), reader.GetString("proj_name"), reader.GetString("description"), reader.GetString("name"), reader.GetDateTime("first_init_date"), reader.GetDateTime("warranty_start_date"), reader.GetInt32("warranty_period"), reader.GetInt32("event_id"), reader.GetDouble("amount")); } } reader.Close(); ProjectReports.ProjectRepot1 report = new ProjectReports.ProjectRepot1(); report.Database.Tables["Project_1"].SetDataSource(table); crystalReportViewer1.ReportSource = null; crystalReportViewer1.ReportSource = report; } catch (Exception exc) { MessageBox.Show(exc.ToString()); } }