Psalm 119:7 (NIV)
7 I will praise you with an upright heart as I learn your righteous laws

David was a man after God�s own heart. He desired to be like God and to follow in his ways. Yet David stumbled often in his walk with God as so many have; but David was always willing to humble himself before God and take responsibility for his failures.

Acts 13
17 The God of this people of Israel chose our fathers, and exalted the people when they dwelt as strangers in the land of Egypt, and with an high arm brought he them out of it.

18 And about the time of forty years suffered he their manners in the wilderness.

19 And when he had destroyed seven nations in the land of Chanaan, he divided their land to them by lot.

20 And after that he gave unto them judges about the space of four hundred and fifty years, until Samuel the prophet.

21 And afterward they desired a king: and God gave unto them Saul the son of Cis, a man of the tribe of Benjamin, by the space of forty years.

22 And when he had removed him, he raised up unto them David to be their king; to whom also he gave their testimony, and said, I have found David the son of Jesse, a man after mine own heart, which shall fulfil all my will.

23 Of this man's seed hath God according to his promise raised unto Israel a Saviour, Jesus:

We see through these verses the people of Israel were always seeking the wrong thing or person. The David came along and declare him a man after His own heart, which shall fulfil all my will. It was through David�s linage that Christ was born and gave His life for all people to free the from sin. So through David, through Christ God�s will was fulfilled.