Example #1
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            string        baglanti = "Data Source =.\\SQLEXPRESS; Initial Catalog = otokiralama; Integrated Security = true;";
            SqlConnection conn     = new SqlConnection(baglanti);

            if (conn.State == ConnectionState.Closed)
            {
                conn.Open();
            }
            SqlCommand    sorgula = new SqlCommand("select * from admin where kullaniciadi = '" + textBox1.Text + "' and sifre='" + textBox2.Text + "'", conn);
            SqlDataReader dr      = sorgula.ExecuteReader();

            if (dr.Read())
            {
                Anasayfa frm = new Anasayfa();
                frm.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("Kullanıcı Adı veya Şifre yanlış…");
                temizle();
            }
        }