예제 #1
0
        private void btnlogin_Click(object sender, EventArgs e)
        {
            conn.Open();
            SqlCommand komut = new SqlCommand("select * from tblUser u where u.Admin=@u1 and u.Password=@u2", conn);

            komut.Parameters.AddWithValue("@u1", txtuser.Text);
            komut.Parameters.AddWithValue("@u2", txtpswd.Text);
            SqlDataReader dr = komut.ExecuteReader();

            if (dr.Read())
            {
                Homepage hp = new Homepage();
                hp.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("Kullanıcı Bulunmamaktadır!!");
            }
            conn.Close();
        }