1 Chronicles 17:1-4
17:1 [events that preceded the building of the temple] After David was settled in his palace, he said to Nathan the prophet, “Here I am, living in a palace of cedar, while the ark of the covenant [the symbolic embodiment of God’s power and presence; had been kept at a place north of Jerusalem called Kiriath Jearim (1 Chron. 13:5) for more than sixty years; David returned the ark to Jerusalem (1 Chron. 16:1)] of the LORD is under a tent.”
17:2 Nathan replied [some think Nathan replied too soon (God did not speak to him until later that night)] to David, “Whatever you have in mind, do it, for God is with you. [Nathan was right in saying the temple should be built, but erred in thinking David should be the one to build it; Nathan did not consult the Lord before speaking to David; probably never imagined project would be contrary to God’s will for David]“
17:3 That night the word of God came to Nathan [God’s word to David through Nathan recorded in vv. 4-15], saying:
17:4 “Go [a command, not an option] and tell my [God’s] servant [as king of Israel, David was God’s servant] David, ‘This is what the LORD [the message recorded in these verses came from God] says: You are not [David had a role in a specific part of God’s plan, but he was simply a part; David was not the plan] the one [cf. 1 Chron. 22:8-10] to build me a house [temple] to dwell in [in reality, God would rather dwell in people’s hearts (cf. 1 Pet. 2:4-5)].
1 Chronicles 17:7,10b-14
17:7 “Now then [after summary of what God had done for Israel and for David], tell my servant David, ‘This is what the LORD Almighty says: I took you from the pasture and from following the flock, to be ruler [leader, captain; people needed a ruler to give stability and lead nation militarily] over my people Israel.
17:10b “‘I declare to you that the LORD will build a house [dynasty; this “house” would outlast the temple house which was ultimately destroyed by Nebuchadnezzar in 6th century BC] for you:
17:11 When your days are over and you go to be with your fathers, I will raise up your offspring [can refer to immediate offspring (Solomon) or future descendants] to succeed you, one of your own sons, and I will establish his kingdom.
17:12 He [Solomon: sounds like and may be derived from the Hebrew word for peace (shalom); cf. 1 Chron. 22:9-10] is the one who will build a house for me, and I will establish his throne [a continuing dynasty] forever [made possible by Jesus Christ, the only one to possess a rule that is endless (cf. Lk. 1:32-33)].
17:13 [vv. 13-14 look beyond Solomon to Jesus Christ — the son of David and the son of God (cf. Ps. 2)] I will be his father, and he will be my son [cf. Heb. 1:5]. I will never take my love [Heb. hesed: mercy; lovingkindness] away from him [God’s covenant with David (cf. Ps. 89:3,28)], as I took it away from your predecessor [Saul].
17:14 I will set him over my house and my kingdom forever [permanent status over God’s kingdom]; his [Jesus Christ] throne will be established forever.’ “
17:16-27 David’s prayer of response to the promise
17:16-19 Gratitude for promise of a everlasting kingdom ruled by descendant
17:20-22 Praise for what God had done in redeeming Israel
1 Chronicles 17:23-27
17:23 [David prayed in line with God’s will; note two requests] “And now, LORD,  let the promise [basically means word; to build an eternal house/dynasty through David’s descendants] you have made concerning your servant and his house be established forever [points toward a time beyond that of David and Solomon]. Do as you promised [or have spoken; cf. vv. 10b-14],
17:24  so that it will be established and that your [God’s] name [represented a person’s character or reputation] will be great [cf. v. 8 where God promised to make David’s name great] forever [David wanted God’s name (not his) to be remembered forever]. Then men will say, ‘The LORD Almighty, the God over Israel, is Israel’s God!’ And the house of your servant [even as king of Israel, David recognized he was ultimately under the Lord’s rule] David will be established before you.
17:25 “You, my God, have revealed to your servant that you will build a house for him. So your servant has found courage to pray to you.
17:26 [David expressed his faith in the immediate and eternal fulfillment of God’s words] O LORD, you are God! You have promised these good things to your servant.
17:27 Now you have been pleased to bless the house of your servant, that it may continue forever in your sight; for you, O LORD, have blessed it, and it will be blessed forever.”