2 Samuel 11
King David got complacent. Complacency breeds contempt.
2 Samuel 11:1-2 ESV
In the spring of the year, the time when kings go out to battle, David sent Joab, and his servants with him, and all Israel. And they ravaged the Ammonites and besieged Rabbah. But David remained at Jerusalem. It happened, late one afternoon, when David arose from his couch and was walking on the roof of the king's house, that he saw from the roof a woman bathing; and the woman was very beautiful.
That's not to say that keeping busy will completely prevent you from having an affair, but it sire might help.
Second mistake, he let his flesh enjoy the beauty of a woman who was not his wife. Your wife is your definition of beauty. And no other woman is yours to enjoy. Period.
Heavenly Father, please help me stay on task and at work in your Kingdom. I know that the enemy will tempt me and try to distract me, but please give me strength and integrity to be faithful to you and faithful to my wife. You have blessed me with a wonderful wife. I love you, Lord. I ask in the name of Jesus.