Have you noticed how your boss treats others in your workplace? If he's only singling you out for criticism, then it's understandable why you'd get discouraged. It also may indicate that you need to try harder, or else seek a job more in line with your abilities.
But I suspect you aren't alone; your boss probably acts like this toward everyone under him. Unfortunately, some leaders believe that the only way to get people to do their jobs is to criticize them; they're afraid that if they praise them, they'll grow lazy. When King Solomon died, his son foolishly refused the advice of those who urged him to reward the people for their hard work -- and as a result, the nation was split into two kingdoms (see 1 Kings 12).
If someone does a good job (whether it's at work, in a family, or anywhere else), they deserve our appreciation, and this will encourage them to do better. The Bible says, "A word fitly spoken is like apples of gold in settings of silver" (Proverbs 25:11, NKJV).
Your boss, however, probably won't change, so don't let his personality get you down. In fact, if he has a legitimate concern, thank him for it. Pray that you'll be the best worker you can possibly be. And pray for him, as well; his attitude may come from his own unhappiness. Above all remember the Bible's words: "It is the Lord Christ you are serving" (Colossians 3:24).