示例#1
0
        private void bunifuThinButton26_Click(object sender, EventArgs e)
        {
            panel2.Visible = true;
            panel2.BringToFront();


            try
            {
                MyDbConnect obj = new MyDbConnect();
                if (obj.OpenConnection())
                {
                    MySqlCommand    cmd        = new MySqlCommand("Select * from Students", obj.connection);
                    MySqlDataReader dataReader = cmd.ExecuteReader();
                    if (dataReader.HasRows)
                    {
                        DataTable dt = new DataTable();
                        dt.Load(dataReader);
                        dataGridView1.DataSource = dt;
                    }
                }
            }
            catch (Exception e1) { MessageBox.Show(e1.ToString()); }
        }
示例#2
0
        private void bunifuThinButton28_Click(object sender, EventArgs e)
        {
            string un   = bunifuMaterialTextbox13.Text;
            string pass = bunifuMaterialTextbox12.Text;


            MyDbConnect m1 = new MyDbConnect();

            m1.OpenConnection();
            AdminLoginDAO a1 = new AdminLoginDAO();

            if (un.Equals("Admin") && pass.Equals("Admin123"))
            {
                this.Hide();
                new Admin().Show();
            }

            else if (a1.AdminLogin(un, pass))
            {
                this.Hide();
                new Trainer().Show();
            }
            m1.CloseConnection();
        }