Note that the discussion of King David not having sinned means that he did not commit adultery because she was divorced as shown in http://judaism.stackexchange.com/questions/13594/anyone-who-says-these-people-sinned-is-mistaken-for-realAnyone who says these people sinned is mistaken. For real? It does not mean that he did not do wrong but that since she was not married, he was allowed to marry her and their son, Shlomo, was able to become king. Also note that Shlomo was born after they were married as the child of that initial union died.
We also see that he did repent for his action and accepted the rebuke of the prophet. However, he was guilty of "abuse of authority" not adultery.