Originally Posted by KBlaix
The best thing you can do is ignore him when he does that. I know it's frustrating and hard to ignore. He's trying to get your attention and even though you're telling him "NO!" you are still giving in to him and giving him the attention he wants. When he stops whining and is being quiet tell him good boy, and give him a treat. He needs to learn that whining will get him nothing but being quiet will get him the attention he wants.
Spanking is never a good idea with dogs because they don't understand what they are doing wrong and why you are hitting them. The only thing that spanking is going to do is cause your dog to be afraid of you.
When you're eating put him in another room. Ignore him if he whines.