The Old Testament (O.T.) is the New Testament (N.T.) concealed and the New Testament is the Old Testament revealed. The Old Testament is like a signpost in darkness pointing forward toward the New Testament reality. It is a shadow of that reality, a foresight of things to come, a foretaste of God's bountiful table. It is an anxious anticipation of the fulfillment of hope, a prescience book describing the coming revelation of God in the person of His Son, Jesus Christ, His O.T. prophesied Messiah.
David also prayed to know God's will more completely because He is our God, and He is good, and David's desire and delight was to live in the uprightness of God's will within God's law. "Teach me to do thy will; for thou art my God: thy spirit is good; lead me into the land of uprightness." Psm.143:10. Yes, David also sinned and he disobeyed God in his fleshly weakness, from time to time, but that only proved he was human, not divine, and would, like us, have been hopeless without God's grace, forgiveness and salvation.
Jesus taught us to pray, as David prayed, for God's will. The so called "Lord's Prayer" is not His prayer but a "model prayer" for us, not for Him. In it, the model prayer, asks, "Forgive us our sins....", but Jesus had no sins. We are the sinners. In that prayer, He also taught us to pray for God's will "in earth"; In our lives and the lives of others. But God's will is not just a matter of the law, it is a matter of the heart. "After this manner therefore pray ye: Our Father which art in heaven, Hallowed be thy name. Thy kingdom come, Thy will be done in earth, as it is in heaven." Matt.6:9-10
Jesus not only taught us to pray for God's will, but He set the example in his own prayer preceding his crucifixion... "And he went a little farther, and fell on his face, and prayed, saying, O my Father, if it be possible, let this cup pass from me: nevertheless not as I will, but as thou wilt." Matt.26:39.
Jesus' flesh resisted death, didn't want to suffer, but the Spirit of Christ in him 'yielded willingly to God's perfect will and purpose. With this he cautioned his disciples to .... "Watch and pray, that ye enter not into temptation: the spirit indeed is willing, but the flesh is weak." Matt.26:41
There are three levels of faith, (1) Simple Salvation Faith "For by grace are ye saved through faith...."; (2) Miracle Working Faith. If Jesus had stopped praying after he prayed, "let this cup pass from me....", a miracle would have crushed his enemies and his father would have delivered him from being crucified and there would be no salvation for us. That, of course, couldn't happen because his death was prophesied and he came to die in his flesh. (3) Faith to yield our will to God's perfect will regardless the pain, loss or death itself. “And being found in fashion as a man, he humbled himself, and became obedient unto death, even the death of the cross.” Phil.2:8. Mary, the virgin Mother of the Jesus' body, which Christ occupied, came to that third level of faith when she prayed, to thy word ...." Lk. 1:28. Even though she was a virgin, and pregnancy was humanly impossible, and nobody would believe her. Everybody would think she was lying and an immoral woman, and she might lose Joseph, as well as her reputation, she still yielded to God's will.... "... be it unto me according to thy word ....".
The Old Testament was a preoccupied shadow of Jesus and the New Testament:
1. For the law having a shadow of good things to come, and not the very image of the things, can never with those sacrifices which they offered year by year continually make the comers thereunto perfect. (The blood sacrifice of animals could never Cleanse, make whole, justify or forgive sin. RB).