Beispiel #1
0
        public void zaloguj_Click(object sender, EventArgs e)
        {

            string user = tbUser.Text;
            string pass = tbPass.Text;

            if (isLogin(user, pass))
            {
                    
                ProgramGlowny gabinet = new ProgramGlowny();
                gabinet.Show();
                this.Hide();
                //  this.Close();

            }
            else
            {
                MessageBox.Show($"{user} nie istnieje takie konto w bazie");

            }


        }
Beispiel #2
0
        private void btnZaloguj2_Click(object sender, EventArgs e)
        {

            string user = tbUser.Text;
            string pass = tbPass.Text;



            string query = $"SELECT id_uzytkownik FROM uzytkownik WHERE uzytkownik_nazwa='{user}' AND haslo='{pass}';";
           
            MySqlCommand cmd = new MySqlCommand(query, conn);

            try
            {
                conn.Open();

               
                cmd.ExecuteNonQuery();
             
                conn.Close();

                ProgramGlowny gabinet = new ProgramGlowny();
                gabinet.Show();
                this.Hide();
            }

            catch (Exception komunikat)
            {
                MessageBox.Show(komunikat.Message);

            }





        }