private void btn_appoint_Click(object sender, EventArgs e) { int BugID = 0; if (textBox_bugID.Text.Trim() != "") { BugID = int.Parse(textBox_bugID.Text.Trim()); } string BugTitle = textBox_BugTitle.Text.Trim(); //connecting to the database MySqlConnection conn = new MySqlConnection("server = localhost; user id = root; database = bugtracker"); try { MySqlCommand sda = new MySqlCommand("update bug set assignedto='" + this.comboBox_assign.Text + "' WHERE bug.id= '" + this.textBox_bugID.Text + "'", conn); //Open Connection conn.Open(); int rows = sda.ExecuteNonQuery(); //if Inserted rows is greater is greater than 0 //Else set isSuccess to false, Save Failed if (rows > 0) { MessageBox.Show("Bug Assigned. click ok to continue"); //Refresh Data Grid View AssignBug vb = new AssignBug(); DataTable dt = vb.SelectBug(); dataGridView1.DataSource = dt; } else { MessageBox.Show("Bug failed to Assigned. click ok to continue"); } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); } finally { //CLose Connection conn.Close(); } }
private void AssignBug_Load(object sender, EventArgs e) { //creating datatable to hold the categories from database AssignBug a = new AssignBug(); DataTable dtassign = a.SelectUSer(); //specify datasource for assigned box comboBox_assign.DataSource = dtassign; //specify display member and valuemenber for combobox comboBox_assign.DisplayMember = "username"; comboBox_assign.ValueMember = "username"; //datagird view AssignBug vu = new AssignBug(); DataTable dt = vu.SelectBug(); dataGridView1.DataSource = dt; }
private void btn_assign_Click(object sender, EventArgs e) { AssignBug ab = new AssignBug(); ab.Show(); }