The reason corn gives you diarrhea is that corn contains a lot of insoluble fiber and that insoluble fiber is hard for your stomach to digest which leads to bloating, gas pains and even the diarrhea.
Some people experience the diarrhea while eating corn and some people don't as it just depends on how good they can digest the corn.
It could also be that you'r eating too much of the corn and if you slow down on eating the corn and eat the corn in moderation you may not experience the diarrhea.