public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { CrystalReportServicePrice rpt = new CrystalReportServicePrice(); rpt.Site = this.Site; return(rpt); }
private void btnPrint_Click(object sender, EventArgs e) { try { string query = "SELECT service_price_ID,service_name,vehicle_type,service_fee FROM service_price,service,vehicle_type WHERE service_price.service_ID=service.service_ID AND service_price.vehicletype_ID=vehicle_type.vehicletype_ID"; dbcon.mysqlconnect.Open(); MySqlCommand cmd = new MySqlCommand(query, dbcon.mysqlconnect); MySqlDataAdapter adp = new MySqlDataAdapter(); DataSet dt = new DataSet(); adp.SelectCommand = cmd; adp.Fill(dt, "service_price"); CrystalReportServicePrice reporting = new CrystalReportServicePrice(); reporting.SetDataSource(dt); frmReports frmreports = new frmReports(); frmreports.crystalReportViewer.ReportSource = reporting; frmreports.crystalReportViewer.Refresh(); cmd.Dispose(); adp.Dispose(); dt.Dispose(); dbcon.mysqlconnect.Close(); frmreports.ShowDialog(); } catch (Exception) { throw; } }