To prevent this annoying habit, teach your dog to accept short periods of confinement before leaving him alone for long periods of time. Spend time with your dog in the area where he is left and show him that this is a fun place to be. If he starts to whine or cry when you leave, don't rush back to let him out or reassure him. If you do. he will soon learn that he can control you with vocal, emotional blackmail. If he does bark, whine or complain, he probably is not yet comfortable in his confinement area. Spend a little more time with him there. Then when you leave, it he barks or whines, give him a loud and stern 'NO!' After he has been quiet for a few moments, return and praise him lavishly. Practice leaving and returning several times so he becomes accustomed to your departures and realizes that you are not abandoning him forever. He will see that you will return and there's nothing to worry about. Practice leaving him for longer and longer periods of time.
If your dog is whining when you are at home, either for attention or just out of habit, the first step in stopping this is to provide your dog with daily routines of play, exercise and training. Often these special times of undivided attention will stop the dog from whining the rest of the day. Secondly, pay attention to your dog only when he is quiet. Ignore him whenever he begins demanding your attention. Each time you give in to your dog's demands, you are training him to continue demanding. If you want a few moments of peace, you can teach the dog to be quiet on request. Gently ask your dog to please 'Be Quiet.' If he ignores you and continues whining, immediately shout a very loud, 'BE QUIET!!' or squirt the dog in the face with water. After a few repetitions, the dog will get the idea and obey the first gentle request of 'Be Quiet,' rather than get screamed at or doused with water.
Unusual whining or whining that starts suddenly when it never existed before may be your dog's way of telling you that something is wrong. See your veterinarian right away to be sure no health problems exist.
Check here for more information on Puppy Whining, Barking, Separation Anxiety or Training Tips for the New Puppy Owner.