private void nsrpReport() { _report a = new _report(); string iQry = @"SELECT date `DATE`, concat(surname, ', ', firstname, ' ', middlename) `NAME`, dob `BIRTHDAY`, age `AGE`, IF(sex = 'MALE','M','F') `GENDER`, civil_status `CIVIL STATUS`, religion `RELIGION`, 'BIRTHPLACE' `BIRTHPLACE`, concat(brgy, ', ' , municipality, ', ', province) `ADDRESS`, email `EMAIL`, cp_no `CONTACT`, `4ps` `4Ps`, emp_status `EMP. STATUS`, job_pre `JOB PREF.`, educ_level `EDUC. LEVEL`, skills `SKILLS`, `from` `FROM` FROM ofw2 where date between '{0}' and '{1}' order by date"; dataset ds = new dataset(); string qry = string.Format(iQry, dateTimePicker1.Text, dateTimePicker2.Text); using (MySqlConnection conn = new MySqlConnection(DBConn.connstring)) { conn.Open(); MySqlCommand cmd = new MySqlCommand(qry, conn); MySqlDataAdapter adapter = new MySqlDataAdapter(); adapter.SelectCommand = cmd; adapter.Fill(ds, ds.Tables["nsrpReport"].TableName); _cr_nsrp rep = new _cr_nsrp(); rep.SetDataSource(ds); a.crystalReportViewer1.ReportSource = rep; a.ShowDialog(); } }
private void button5_Click_1(object sender, EventArgs e) { _report a = new _report(); string iQry = @"select * from ( SELECT date `DATE`, concat(surname, ', ', firstname, ' ', middlename) `NAME`, dob `BIRTHDAY`, age `AGE`, IF(sex = 'MALE','M','F') `GENDER`, civil_status `CIVIL STATUS`, religion `RELIGION`, birthplace `BIRTHPLACE`, concat(brgy, ', ' , municipality, ', ', province) `ADDRESS`, email `EMAIL`, cp_no `CONTACT`, `4ps` `4Ps`, emp_status `EMP. STATUS`, job_pre `JOB PREF.`, educ_level `EDUC. LEVEL`, skills `SKILLS`, `from` `FROM` FROM schoolar_coll union all SELECT event_date `DATE`, concat(surname, ', ', firstname, ' ', middlename) `NAME`, dob `BIRTHDAY`, age `AGE`, IF(sex = 'MALE','M','F') `GENDER`, civil_status `CIVIL STATUS`, religion `RELIGION`, 'BIRTHPLACE' `BIRTHPLACE`, concat(brgy, ', ' , municipality, ', ', province) `ADDRESS`, email `EMAIL`, cp_no `CONTACT`, `4ps` `4Ps`, emp_status `EMP. STATUS`, job_pre `JOB PREF.`, educ_level `EDUC. LEVEL`, skills `SKILLS`, `from` `FROM` FROM sra2 union all SELECT event_date `DATE`, concat(surname, ', ', firstname, ' ', middlename) `NAME`, dob `BIRTHDAY`, age `AGE`, IF(sex = 'MALE','M','F') `GENDER`, civil_status `CIVIL STATUS`, religion `RELIGION`, 'BIRTHPLACE' `BIRTHPLACE`, concat(brgy, ', ' , municipality, ', ', province) `ADDRESS`, email `EMAIL`, cp_no `CONTACT`, `4ps` `4Ps`, emp_status `EMP. STATUS`, job_pre `JOB PREF.`, educ_level `EDUC. LEVEL`, skills `SKILLS`, `from` `FROM` FROM jobfair2 union all SELECT date `DATE`, concat(surname, ', ', firstname, ' ', middlename) `NAME`, dob `BIRTHDAY`, age `AGE`, IF(sex = 'MALE','M','F') `GENDER`, civil_status `CIVIL STATUS`, religion `RELIGION`, 'BIRTHPLACE' `BIRTHPLACE`, concat(brgy, ', ' , municipality, ', ', province) `ADDRESS`, email `EMAIL`, cp_no `CONTACT`, `4ps` `4Ps`, emp_status `EMP. STATUS`, job_pre `JOB PREF.`, educ_level `EDUC. LEVEL`, skills `SKILLS`, `from` `FROM` FROM kasambahay2 union all SELECT date `DATE`, concat(surname, ', ', firstname, ' ', middlename) `NAME`, dob `BIRTHDAY`, age `AGE`, IF(sex = 'MALE','M','F') `GENDER`, civil_status `CIVIL STATUS`, religion `RELIGION`, 'BIRTHPLACE' `BIRTHPLACE`, concat(brgy, ', ' , municipality, ', ', province) `ADDRESS`, email `EMAIL`, cp_no `CONTACT`, `4ps` `4Ps`, emp_status `EMP. STATUS`, job_pre `JOB PREF.`, educ_level `EDUC. LEVEL`, skills `SKILLS`, `from` `FROM` FROM ofw2 union all SELECT date `DATE`, concat(surname, ', ', firstname, ' ', middlename) `NAME`, dob `BIRTHDAY`, age `AGE`, IF(sex = 'MALE','M','F') `GENDER`, civil_status `CIVIL STATUS`, religion `RELIGION`, 'BIRTHPLACE' `BIRTHPLACE`, concat(brgy, ', ' , municipality, ', ', province) `ADDRESS`, email `EMAIL`, cp_no `CONTACT`, `4ps` `4Ps`, emp_status `EMP. STATUS`, job_pre `JOB PREF.`, educ_level `EDUC. LEVEL`, skills `SKILLS`, `from` `FROM` FROM contact2 ) fin order by date"; dataset ds = new dataset(); using (MySqlConnection conn = new MySqlConnection(DBConn.connstring)) { conn.Open(); MySqlCommand cmd = new MySqlCommand(iQry, conn); MySqlDataAdapter adapter = new MySqlDataAdapter(); adapter.SelectCommand = cmd; adapter.Fill(ds, ds.Tables["nsrpReport"].TableName); _cr_nsrp rep = new _cr_nsrp(); rep.SetDataSource(ds); a.crystalReportViewer1.ReportSource = rep; a.ShowDialog(); } }