Exemplo n.º 1
0
        public void Login(Users user)
        {
            ConnectionControl();
            command = new SqlCommand("Select UserName,UserPassword From Users Where UserName=@UserName And UserPassword=@UserPassword", _connection);
            command.Parameters.AddWithValue("@UserName", user.UserName);
            command.Parameters.AddWithValue("@UserPassword", user.UserPassword);
            reader = command.ExecuteReader();

            if (reader.Read())
            {
                HomeScreen homeScreen = new HomeScreen();
                homeScreen.Show();
            }
            else
            {
                MessageBox.Show("Login Failed");
            }
            _connection.Close();
        }
Exemplo n.º 2
0
        private void btnEntry_Click(object sender, EventArgs e)
        {
            string query = "SELECT * FROM Users where UserName = '******' AND UserPassword = '******'";

            ConnectionControl();
            _command.Connection  = _connection;
            _command.CommandText = query;
            _reader = _command.ExecuteReader();
            if (_reader.Read())
            {
                HomeScreen home = new HomeScreen();
                this.Hide();
                home.Show();
            }
            else
            {
                MessageBox.Show("Kullanıcı bilgilerini kontrol ediniz");
            }
            _connection.Close();
        }