I got rejected countless times for my first book. Then a year later, (after an editor encouraged me to do so) I revised and when I submitted the second time, I had a few offers right away. The second one was published by the same publisher.
The third one I got an agent for after 30 or so rejections only one agent was interested then offered. And even though we parted ways, she referred me to a publisher that later on accepted.
My fourth about a handful of rejections, then I got an agent who was crap, so I fired her and did it on my own. I was very selective when I submitted and the process itself dragged on for two years total, but got an awesome publisher for that one too.
My fifth novel is a pimple on my ass that won't pop. I've drowned out probably every agent out there in the world that accepts that genre have gotten a lot of interest, but no go. I've also submitted to about 40 or so publishers and have gotten really really close, 5 different revisions in total and the thing still hasn't popped with anyone yet. But it would break my heart and then some if I decide to trunk it.
Working on a sixth novel and hope things will be easier...but I have a feeling they won't.