@Jincowboy: if it's urgent then please read the SO guidelines and post an executable code example (MCVE) in the question so people can reproduce it. And instead of saying something like
"I am not getting correct thing, this is error also", post the exact text of the error in your question (or show the wrong output). And please read
How do I ask a good question?, then edit your question to follow the guidelines, more likely to get answers then.