public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { CRTLeadvoters rpt = new CRTLeadvoters(); rpt.Site = this.Site; return(rpt); }
private void button_WOC1_Click(object sender, EventArgs e) { if (txtsearchvoters.Text == "") { MessageBox.Show("Please Enter the Name of Leader or the Barangay"); } else { if (Leaderselect == "Barangay") { try { CRTBarvoters cr = new CRTBarvoters(); conn = new MySqlConnection(); conn.ConnectionString = connString; conn.Open(); // string sql = "SELECT * from users where UID ='" +textBox1.Text+"' "; string sql = "Select * From voterslist where Barangay LIKE '%" + txtsearchvoters.Text + "%' ORDER BY VotersID DESC"; DataSet ds = new DataSet(); MySqlDataAdapter adapter = new MySqlDataAdapter(sql, conn); adapter.Fill(ds, "voterslist"); DataTable dt = ds.Tables["voterslist"]; cr.SetDataSource(ds.Tables["voterslist"]); crptviewvoters.ReportSource = cr; crptviewvoters.Refresh(); } catch (MySql.Data.MySqlClient.MySqlException ex) { MessageBox.Show(ex.Message); } } else if (Leaderselect == "Leader") { try { CRTLeadvoters cr = new CRTLeadvoters(); conn = new MySqlConnection(); conn.ConnectionString = connString; conn.Open(); // string sql = "SELECT * from users where UID ='" +textBox1.Text+"' "; string sql = "Select * From voterslist where leader LIKE '%" + txtsearchvoters.Text + "%' ORDER BY fullname ASC"; DataSet ds = new DataSet(); MySqlDataAdapter adapter = new MySqlDataAdapter(sql, conn); adapter.Fill(ds, "voterslist"); DataTable dt = ds.Tables["voterslist"]; cr.SetDataSource(ds.Tables["voterslist"]); crptviewvoters.ReportSource = cr; crptviewvoters.Refresh(); } catch (MySql.Data.MySqlClient.MySqlException ex) { MessageBox.Show(ex.Message); } } else { MessageBox.Show("Please Select "); } } }