Rejection sticks! Yea...hardly news, right. However, when faced with the rejections that are inevitably going to come, you have to remember what started the writing in the first place. The IDEA!
Go back to the idea and make it better. Get a critique partner or two. Join an online support group. REWRITE. Rework the query or opening pages.
But the main thing to remember is the IDEA. You thought it was good enough to start writing the story, have faith in it now!
Publishing is a two way street. Agents and Editors need to have a sellable manuscript and you have to provide them with the sellable idea in that manuscript!