I have found this thread rather late in the day and there are many pearls of wisdom in there already.
The main message is that we have all been there and know exactly how you feel. Submitting work to agents is rather like entering your adored infant into a beautiful baby competition knowing the most likely response from the judges will be "Good God, that's ugly!" But we all keep doing it. Why? The answer is that we are proud of our work and believe that it is worthy of publication.
Writing a book is a significant achievement; not many people manage it and most would not even bother trying. As has been mentioned there are books that have been published and we wonder why they were. Equally there are excellent books which have not been published because they have not been read by the right agent. Keep faith, keep trying and eventually you will succeed.