When God initiated His covenant with David, God pledged that David's throne would be firmly established and that there will always be a son of David to sit on the throne, until ultimately, God's own Son, will sit on the throne, from the line of David. You'll read the entire account in 2 Samuel chapter 7 which basically God made with David an unconditional covenant. I'm gonna read to you the summary of that covenant where God said to David, which was summed up in 1 Chronicles 17:11-14;
11 "When your days are fulfilled that you must go to be with your fathers, that I will set up one of your descendants after you, who will be of your sons; and I will establish his kingdom. 12 "He shall build for Me a house, and I will establish his throne forever *. 13 "I will be his father and he shall be My son; and I will not take My lovingkindness away from him, as I took it from him who was before you. 14 "But I will settle him in My house and in My kingdom forever *, and his throne shall be established forever ." (1 Chronicles 17:11-14)