private void button1_Click(object sender, EventArgs e)
        {
            System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection();
            conn.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;" + @"Data source=Deneme1.accdb";
            string sqlPerson = "SELECT PersonelAdi, Parola FROM Personel";

            try
            {
                conn.Open();
                OleDbCommand    command = new OleDbCommand(sqlPerson, conn);
                OleDbDataReader reader  = null;
                reader = command.ExecuteReader();
                bool dogrulama = false;
                while (reader.Read())
                {
                    if (textUsername.Text == reader[0].ToString() && textPasword.Text == reader[1].ToString())
                    {
                        dogrulama = true;
                        MessageBox.Show("Giris Basarili", "Tamam", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        Personel pers = new Personel();
                        pers.ShowDialog();
                    }
                }

                if (!dogrulama)
                {
                    MessageBox.Show("Doğrulama başarısız", "Hatalı Bilgiler", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                conn.Close();
            }
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            Personel pers = new Personel();

            this.Close();
        }