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; } }
private void Print_Click(object sender, EventArgs e) { try { string query = "SELECT emp_ID, emp_fName,emp_gName,emp_mInitial,emp_position,emp_address FROM employee"; dbcon.mysqlconnect.Open(); MySqlCommand cmd = new MySqlCommand(query, dbcon.mysqlconnect); MySqlDataAdapter adp = new MySqlDataAdapter(); DataSet dt = new DataSet(); adp.SelectCommand = cmd; adp.Fill(dt, "Employee"); CrystalReportEmployee reporting = new CrystalReportEmployee(); 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; } }
private void button1_Click(object sender, EventArgs e) { try { string query = "SELECT userID, fName,gName,mInitial,user_address,username,password,user_type FROM users"; dbcon.mysqlconnect.Open(); MySqlCommand cmd = new MySqlCommand(query, dbcon.mysqlconnect); MySqlDataAdapter adp = new MySqlDataAdapter(); DataSet dt = new DataSet(); adp.SelectCommand = cmd; adp.Fill(dt, "User"); CrystalReportUser reporting = new CrystalReportUser(); 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; } }