//show all button click private void button1_Click(object sender, EventArgs e) { BugHistory vu = new BugHistory(); DataTable dt = vu.Select_bugs(); dgv_history.DataSource = dt; }
private void cmb_bugname_SelectedIndexChanged(object sender, EventArgs e) { string type = cmb_bugname.Text; BugHistory vu = new BugHistory(); DataTable dt = vu.Sort_usertype(type); dgv_history.DataSource = dt; }
private void BugHistory_Load(object sender, EventArgs e) { //creating datatable to hold the categories from database //to get project titile from database MySqlConnection conn = new MySqlConnection("server = localhost; user id = root; database = bugtracker"); MySqlDataReader myreader; try { //getting data from database using dataadapter MySqlCommand sda = new MySqlCommand("Select BugTitle from bug", conn); //Create a Datatable to hold the records from database //Step 5:Open Connection conn.Open(); myreader = sda.ExecuteReader(); while (myreader.Read()) { cmb_bugname.Items.Add(myreader.GetValue(0).ToString()); } conn.Close(); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); } finally { //Step 8: Close Connection conn.Close(); } // Data Grid View BugHistory vu = new BugHistory(); DataTable dt = vu.Select_bugs(); dgv_history.DataSource = dt; }
private void button_history_Click(object sender, EventArgs e) { BugHistory bh = new BugHistory(); bh.Show(); }