David prayed to God that his son, Solomon would obey God. Solomon succeeded David as king and they were both good to God, so God blessed them both. David and Solomon were two of the three kings who reigned over both kingdoms while they were still united. Later on the kings would generally get worse, the kingdom would be split apart and God would not be as present. However, during the times of the first three kings things were good.