1 Chronicles 14:10

And David enquired of God, saying, Shall I go up against the Philistines? and wilt thou deliver them into mine hand? And the LORD said unto him, Go up; for I will deliver them into thine hand.

David's asking whether to go up against the Philistines and whether they would be given into his hand belongs to the time after he had become king over all Israel. In that position he continued to grow in power and success. That increase came because the Lord God of hosts was with him.