Exemplo n.º 1
0
        private void backButt_Click(object sender, EventArgs e)
        {
            this.Hide();
            EateryBot eB = new EateryBot();

            eB.Show();
        }
Exemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            var             connectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;
            MySqlConnection conn             = new MySqlConnection(connectionString.ToString());
            MySqlCommand    cmd = new MySqlCommand("SELECT * FROM Admins WHERE Login=@login AND Password=@pass", conn);

            conn.Open();
            cmd.Parameters.AddWithValue("@login", loginBox.Text);
            cmd.Parameters.AddWithValue("@pass", passwdBox.Text);
            Console.WriteLine(passwdBox.Text, loginBox.Text);
            MySqlDataReader dr = cmd.ExecuteReader();

            if (dr.HasRows == true)
            {
                EateryBot eatery = new EateryBot();
                eatery.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("Неверные данные для входа.");
            }
            conn.Close();
        }