What do you mean by "The above code is not working"?
How could you possibly imagine that we'd have any idea where to start looking with such a poor description of the problem? You don't even provide the credentials, so even if someone wanted to, they couldn't even begin reproduce your problem.
Please put more thought and consideration into your posts. We're smart, but we can't read your screen. Post errors. Post what's happening. Post what you expect to happen. Post what you expect to have returned. Many people have gone way out of their way to provide very detailed and concise help for you. People aren't getting paid to help here, they're doing it out of the goodness of their hearts. Have some respect and put more effort into your posts when you ask for help.