Because David did that which was right in the eyes of the LORD, and turned not aside from any thing that he commanded him all the days of his life, save only in the matter of Uriah the Hittite.
Because David followed God's ways perfectly, never disobeying any command throughout his life, except when it came to Uriah the Hittite.