Luke 1:6

They were both just in the sight of God, blameless in their obedience to all the commands and regulations of God;

Acts 13:22

After deposing him, he raised up David to be their king, to whom he bore this testimony that 'In David, the son of Jessai, I have found a man after my own heart, who will obey all my will.'

Acts 13:36

Of course David, after serving God's purpose in his own generation, died and was laid beside his fathers; he suffered decay,

Treasury of Scripture Knowledge

Summary

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.

Bible References

David

Luke 1:6
They were both just in the sight of God, blameless in their obedience to all the commands and regulations of God;
Acts 13:22
After deposing him, he raised up David to be their king, to whom he bore this testimony that 'In David, the son of Jessai, I have found a man after my own heart, who will obey all my will.'