The book _Happiest Toddler on the Block_ has really helped me with my daughter. She's 20 months, so not quite two yet, but so far it's been great. The basic idea is to affirm their feelings before you tell them no. So if my daughter wants to touch the hot pan on the stove where I'm cooking, I'll say, "you want to touch the pan! You want it! You want to help cook!" until she nods and says yes. Then I explain, "But you can't touch it sweetheart, it's hot! It will burn you!" When she knows that I really do understand what she wants, she's much more willing to hear my explanation. The key is to keep repeating what she wants (and to match her level of emotion in your tone of voice) until she calms down or stops whining. That's when you know that she feels heard. Then she's more able to hear you. Read the book, or at least check out the videos on the website.
As far as defiance, honestly, two year olds are SUPPOSED to go against what you say. They actually really, truly need to "defy" you, to an extent, in order to become independent. Your daughter is learning that she's a separate person from you, and in order to establish a sense of her own identity, separate from you, she needs to disagree with you. That's why she says no whenever you say yes. It's very important for her developmentally. So don't feel like you need to get your daughter to obey all the time in order to teach her. She actually needs to differ from you sometimes in order to become a mature person. It's a stage. Obviously if her behavior is dangerous, then you have to stop it, but if it's not dangerous, well, the easiest thing to do is to limit your rules as much as possible instead of limiting her!

The more she's allowed to explore and play, the less she'll need to break rules. The best way to do this is to set up a "yes" environment as much as possible, so she's allowed to explore, touch, and play with pretty much everything in her environment.
Another book that's helped me is Playful Parenting. That can work really well with whining sometimes. You could try whining yourself--maybe at a time when she's NOT whining, so she doesn't feel like you're making fun of her. Or we play the yes and no game sometimes--if my daughter is saying no, then I'll repeat it with her, "no! no! no!" until she calms down, and then I'll tell her to say no, and then to say yes, and then to say no, and then to say yes. By then we've both forgotten about whatever she was upset about.

That only works if she's mildly upset, though.
Hang in there, mama! It must be SO hard to have a two year old and a six month old. I'm sure your patience is stretched to the limit every day! But seriously--there ARE better ways than spanking and yelling. Make sure you take care of yourself, too--it's very hard to parent effectively and gently when you're exhausted and overwhelmed. Do you have help with the kids during the day? Getting breaks, even little ones, can do wonders for you. Make sure you get enough rest and nap when the kids do if you can.