private void mybutton1_Click(object sender, EventArgs e) { frmReportStaff f = new frmReportStaff(); Clinic.C.RunReportstaff("select staff.staffId,staff.staffName,profession.professionName,staff.phone,staff.email,staff.age,staff.gender,staff.address,specializations.SpecializationsName, (select count(staffId) from profession,staff left join specializations on specializations.SpecializationsId =staff.SpecializationsId where staff.staffId!=0 and staff.professionId =profession.professionId ) as countstaff from profession,staff left join specializations on specializations.SpecializationsId =staff.SpecializationsId where staff.staffId!=0 and staff.professionId =profession.professionId ", f); f.Show(); }
public static void RunReportstaff(string select, frmReportStaff p, DataTable table = null) { //عشان اقوله لو الجدول فاضى هديله البيانات من عندى try { if (table == null) { table = DB.GetData(select); } ReportDataSource rds = new ReportDataSource("DataSet1", table); p.reportStaff.LocalReport.DataSources.Clear(); p.reportStaff.LocalReport.DataSources.Add(rds); p.reportStaff.LocalReport.Refresh(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }