"Create in Me a Clean Heart"
The story of David's fall into sin cautions us from letting temptation lead us into error. But compliance to the law and repentance are not the ultimate purpose of the gospel; the goal is to have a change of heart to a state where we are holy and love God with all our hearts.
"Beware Concerning Yourselves," Anthony D. Perkins, October 2012 General Conference
The Old Testament story of David is a tragic example of squandered priesthood power. Although he defeated Goliath while young and lived righteously for decades, this prophet–king was still spiritually vulnerable. In that crucial moment when from his rooftop he saw beautiful Bathsheba bathing, no moral lifeguard stood near to shout, "Beware, David, you fool!" His failure to beware concerning himself and to act on promptings of the Spirit led to the loss of his eternal family. Brethren, if even mighty David can be swept off the road to exaltation, how can we avoid a similar fate? The twin guardrails of deep personal conversion and strong family relations help keep us on the heavenly highway.
"Clean Hands and a Pure Heart," David A. Bednar, October 2007 General Conference
"The gospel of Jesus Christ encompasses much more than avoiding, overcoming, and being cleansed from sin and the bad influences in our lives; it also essentially entails doing good, being good, and becoming better. Repenting of our sins and seeking forgiveness are spiritually necessary, and we must always do so. But remission of sin is not the only or even the ultimate purpose of the gospel. To have our hearts changed by the Holy Spirit such that "we have no more disposition to do evil, but to do good continually," as did King Benjamin's people, is the covenant responsibility we have accepted. This mighty change is not simply the result of working harder or developing greater individual discipline. Rather, it is the consequence of a fundamental change in our desires, our motives, and our natures made possible through the Atonement of Christ the Lord. Our spiritual purpose is to overcome both sin and the desire to sin, both the taint and the tyranny of sin."
Joseph Smith Papers, Revelation 12 July 1843 [D&C 132]
David's adultery caused him to lose his exaltation, according to D&C 132: "David's wives and concubines were given unto him of me, by the hand of Nathan, my servant, and others of the prophets who had the keys of this power; and in none of these things did he sin against me save in the case of Uriah and his wife; and, therefore he hath fallen from his exaltation, and received his portion; and he shall not inherit them out of the world, for I gave them unto another, saith the Lord." The historical note on this revelation explains, "The impetus for the dictation of the revelation was Hyrum Smith's request that it be written so that he could convince Emma Hale Smith, who did not approve of the practice of polygamy, of the revelation's truthfulness."
"Pornography," Dallin H. Oaks, April 2005 General Conference
To repent of immorality, one must, first, acknowledge the evil; second, seek the help of the Lord and his servants, your bishop; third, do all that you can to avoid temptation; finally, do not patronize pornography.
"2 Samuel 13–24, The Price of Sin: Tragedy in the House of David," Old Testament Institute Student Manual
David's sin of murder led to a chain of misdeeds in his family and associates, notably by Ammon and Absalom. This chapter includes discussions of David's sin and Absalom's treachery, resulting in division in the kingdom and Absalom's death. David's cry over Absalom is a lament that is likely the source of the pain expressed in Psalm 55. David expressed other joys and trials of his life throughout the psalms.