There are two important things.
The first one is that, such a question will usually be a part of an original work. The person who answers your question will even not be aware of your work and his/her name therefore can not be included to your publishable work. However, if a following assistance is required and if the paper is read by the person who helps you, then you can include his/her name.
Second observation is that, he/she will have a contribution to your work anyways and any contribution (at least according to my understanding of an academical work) should be mentioned in the paper. I think perhaps acknowledging his/her help with a nice way of thanking would be really appreciated.