Back in the days when they ran in packs, a dog would never be rewarded by his mates for whining. Rather, he would receive swift correction. Similarly, when your dog whines, you do not want to reinforce the behavior by trying to appease her.
Reasons for Whining
Some dogs whine when they're around other dogs or people because they are adopting a submissive posture. Others whine to get attention, affection or food. Dogs will sometimes whine involuntarily when they're greeting someone, out of excitement. Other times dogs will whine out of sheer stress and anxiety, in which cases the behavior is not intentional. Either way, train your dog to not whine by eliminating positive associations with the behavior and creating negative ones.
Ignore Whining Behavior
Often dogs will whine to get people's attention. It's best to nip this behavior in the bud while they're still young. Regardless, you can still train older dogs with more time and consistency. Simply ignore them if they're whining to get something from you. Every time you give her attention or something she wants, you reinforce the behavior. If her whining falls on deaf ears, however, she'll see that it doesn't accomplish anything. Instead, wait until she becomes quiet and then come back and reward.
Some dogs are just plain stubborn, and will go on whining until the sun comes up regardless if you ignore them. In such cases, simply foregoing positive reinforcement is not enough. You need to create negative associations in her mind with whining. One method is to say "Enough!" in a bold and commanding voice and then to slam a door shut, leaving her in the room by herself. When she becomes quiet, even for a few seconds, go back in her room and greet her in a friendly manner with a treat. This method can take time and dedication to be effective.
One of the best methods to stop whining is to use a squirt gun. When you squirt her with the water pistol every time she whines, it creates a negative association in her mind, and rightly so. If all goes according to plan, she will quickly learn to second-think her inclination to whine. This is a favorable method as it is less negative than slamming a door and saying "Enough!", but still creates a strong unpleasant association for her.
Remember that these methods should only be used for "excessive" whining. Not all whining is bad if it happens infrequently. For example, if your dog is whining because she needs to go out and relieve herself, you would be unfairly punishing her for communicating something that was necessary. Also, if your dog is whining out of joy for seeing you then, well, you can hardly blame her for that.