Promise and obedience
"When David was about to die, he called his son Solomon and gave him his last instructions: “My time to die has come. Be confident and determined, and do what the LORD your God orders you to do. Obey all his laws and commands, as written in the Law of Moses, so that wherever you go you may prosper in everything you do.
If you obey him, the LORD will keep the promise he made when he told me that my descendants would rule Israel as long as they were careful to obey his commands faithfully with all their heart and soul."
~ 1 Kings 2.1-4 GNB
"If you obey the LORD, he will keep his promise to me." Not that it would matter to David once he died, but the promise applied to Solomon too. So it was in Solomon's interest to obey the LORD.
Life is full of "what if". What if Adam and Eve had obeyed? Would mankind still live in the Garden of Eden? What if Solomon had obeyed?
That is life.