Like anything you try to teach children, consistency over time is the key, and you are going to have to repeat yourself a zillion times.
Do not give in or give a response to the whining that shows your toddler that whining works to get his/her way. Make the child speak to you without whining...