These verses really bring to light what we hear so many preachers share with us. We cant get into heaven because we had great parents, or because our grandmother prayed constantly for us. We have to seek God for ourselves and live a committed life to him personally. God promised David a lot in response to his committed life to God, including a promise to even bless his ancestors. In these verses God is telling Solomon that those promises will hold true IF he stays committed to Him and obey His commands. This holds true for us friend, we must have a PERSONAL relationship with God. Do you have that, friend?
If you serve me faithfully as your father David did, obeying my laws and doing everything I have commanded you, I will keep the promise I made to your father David when I told him that Israel would always be ruled by his descendants. But if you and your people ever disobey the laws and commands I have given you, and worship other gods, then I will remove you from the land that I gave you, and I will abandon this Temple that I have consecrated as the place where I am to be worshipped. …