The thought itself that Jesus was married comes from the Gnostic bible which is the book that the DeVinci Code is refering to. This book claims a few extra books that were not allowed into the bible because they did not meet the standards of the "Canon"
In this book Jesus is the husband of Mary however because the book itself make very little since and contradicts itself in some many areas it is really hard to believe in it at all. After having read it I believe there are some points you should consider.
There is a strong disagreement with Thomas and the Book of John which means that quite a bit of the bible would be wrong if any of this book is right.
It completely disagrees with all of the writings of Josephus, who is a historian and person living during the time of Jesus, (who is writing from personal experience, and by the way is not a Christian)
It was not cannonized for the following reasons, It was said to have:
not to have been written close to the time of Jesus
not to have been written by apostolic authority or was forged in Thomas' name
not to have been used by multiple churches over a wide geographic range
to be heretical or unorthodox
not to have been useful or comprehensible
to be secret - or for adepts - as the first sentence of the gospel declares
Another thing just thought you ladies would like to know that by the gnostic bible women cant go to heaven unless they become lesbians or male so men that means we have absolutely no use for you. If you dont believe that please look at this
Gospel of Thomas: (114) Simon Peter said to them: Let Mary go forth from among us, for women are not worthy of the life. Jesus said: Behold, I shall lead her, that I may make her male, in order that she also may become a living spirit like you males. For every woman who makes herself male shall enter into the kingdom of heaven.
I could go on for hours about the crazy stuff I read in the Gnostic Bible and the stuff that people are saying because a gifted writer wrote an exciting book, good grief.