private void Button_back_Click(object sender, EventArgs e)
        {
            techers_own_information form = new techers_own_information();

            this.Hide();
            form.ShowDialog();
            Close();
        }
示例#2
0
        private void Button_login_teacher_Click(object sender, EventArgs e)
        {
            try
            {
                if (textBox_name.Text == "" || textBox_password.Text == "")
                {
                    MessageBox.Show("Fields can not be empty");
                    return;
                }

                MySqlConnection conn2 = new MySqlConnection(conn);
                string          query = "select * from `coaching_management`.`teacher_registration` where Name = '" + textBox_name.Text + "' and Password = '******'  ";
                //  MessageBox.Show(query);
                MySqlDataAdapter sda = new MySqlDataAdapter(query, conn2);
                DataTable        dt  = new DataTable();
                sda.Fill(dt);

                if (dt.Rows.Count == 1)
                {
                    MessageBox.Show("Matched!");
                    string id = dt.Rows[0][0].ToString();
                    teacher_id = Convert.ToInt32(dt.Rows[0][0].ToString());


                    /*
                     * add_result_by_teacher obj = new add_result_by_teacher();
                     * obj.Show();
                     * this.Hide();*/

                    /*techers_own_information obj = new techers_own_information();
                     * obj.Show();
                     * this.Hide();*/
                    techers_own_information obj = new techers_own_information(id);
                    this.Hide();
                    obj.ShowDialog();
                    Close();
                }
                else
                {
                    MessageBox.Show("Did not match");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }