예제 #1
0
        private void btn_ger_Click(object sender, EventArgs e)
        {
            AdminPanel admin = new AdminPanel();

            this.Hide();
            admin.Show();
        }
예제 #2
0
        private void btn_giris_Click(object sender, EventArgs e)
        {
            if (txt_kullaniciAdi.Text != "" && txt_sifre.Text != "")
            {
                SqlConnection scn = new SqlConnection();
                scn.ConnectionString = @"Data Source=DESKTOP-Q9PA9HF;Initial Catalog=login_database;database=stock;integrated security=SSPI";
                if (scn.State != ConnectionState.Open)
                {
                    scn.Open();
                }
                SqlCommand    scmd   = new SqlCommand("select kullanici_adi, kullanici_sifre from login", scn);
                SqlDataReader reader = scmd.ExecuteReader();
                while (reader.Read())
                {
                    if (txt_kullaniciAdi.Text == reader[0].ToString() && txt_sifre.Text == reader[1].ToString())
                    {
                        this.Hide();
                        AdminPanel admin = new AdminPanel();
                        admin.Show();
                    }

                    else
                    {
                        MessageBox.Show("Kullanıcı Adı veya Şifre Hatalı");
                    }
                }

                scn.Close();
            }
            else
            {
                MessageBox.Show("Lütfen gerekli yerleri doldurun");
            }
        }