예제 #1
0
        //button for login
        private void btnLogIn_Click(object sender, EventArgs e)
        {
            MY_DB            db      = new MY_DB();
            MySqlDataAdapter adapter = new MySqlDataAdapter();
            DataTable        table   = new DataTable();
            MySqlCommand     command = new MySqlCommand("SELECT * FROM `ex2` WHERE `username`=@anju AND `pass`=@pass", db.getConnection);

            command.Parameters.Add("@anju", MySqlDbType.VarChar).Value = textBoxUsername.Text;
            command.Parameters.Add("@pass", MySqlDbType.VarChar).Value = textBoxPassword.Text;

            adapter.SelectCommand = command;

            adapter.Fill(table);
            try
            {
                if (table.Rows.Count > 0)
                {
                    MessageBox.Show("You are Logged In.");

                    this.Hide();
                    ManageSystem ms = new ManageSystem();
                    ms.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Inavalid Username and a Password", "Login Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "login", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #2
0
        private void btnBack_Click(object sender, EventArgs e)
        {
            this.Hide();
            ManageSystem ms = new ManageSystem();

            ms.ShowDialog();
        }
예제 #3
0
        private void pictureBox16_Click(object sender, EventArgs e)
        {
            this.Hide();
            ManageSystem Ms = new ManageSystem();

            Ms.Show();
        }