Example #1
0
        private void AssignBugTo_Load(object sender, EventArgs e)
        {
            //Datatable created to hold the categories from database
            AssignBugTo a        = new AssignBugTo();
            DataTable   dtassign = a.Selectutype();

            //Specify datasource for assigned box
            comboBox_assign.DataSource = dtassign;
            //Specify display member and valuemenber for combobox
            comboBox_assign.DisplayMember = "username";
            comboBox_assign.ValueMember   = "username";
            //Data Gird view
            AssignBugTo vu = new AssignBugTo
                                 ();
            DataTable dt = vu.SelectBug();

            dataGridView1.DataSource = dt;
        }
Example #2
0
        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();

            //Database connection
            MySqlConnection conn = new MySqlConnection("server = localhost; user id = root; database = bugbase");

            try
            {
                MySqlCommand sda = new MySqlCommand("update bugreport set assignedto='" + this.comboBox_assign.Text + "' WHERE bugreport.id= '" + this.textBox_bugID.Text + "'", conn);
                //Open Connection
                conn.Open();
                int rows = sda.ExecuteNonQuery();

                if (rows > 0)
                {
                    MessageBox.Show("Bug Assigned. click ok to continue");
                    //Refresh Data Grid View
                    AssignBugTo vb = new AssignBugTo();
                    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();
            }
        }