Luke 1:6

And they were both righteous in the sight of God, walking in all the commandments and ordinances of the Lord blameless.

Acts 13:22

And having removed him, He raised up David for their king, to whom also He gave testimony and said, I have found David the son of Jesse, a man after my own heart, who will perform all my will.

Acts 13:36

Now David having served his own generation according to the will of God, fell asleep, and was laid with his fathers, and saw corruption: but He whom God raised,

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
And they were both righteous in the sight of God, walking in all the commandments and ordinances of the Lord blameless.
Acts 13:22
And having removed him, He raised up David for their king, to whom also He gave testimony and said, I have found David the son of Jesse, a man after my own heart, who will perform all my will.