Take the hands in yours, and say NO in a very very forceful manner, and put the child down and walk off.
That will solve it.
oh yeah the other option is to ignore it because if you make a big deal about it, it may make him or her do it more.
ummm that is a difficult one, you can take the childs hand and look them in the eye and say no no, say something about it hurts mommy. The other way is putting him or her in a time out chair for 1 min. You always go by their age on how long they stay in corner. 1 year old - 1 min, 2 year old - 2 min.