The Da Vinci Code does have some historical truth to it, but it is a fiction book. From what I know Mary Magdelane was one of Jesus' best friends, and close followers. She was with Jesus when he was crucified and Jesus came to her first after he was resurrected. Some people believe that she was Jesus' wife, but it is not proven and many people just believe her to have been a close friend and follower. She is also one of the more mentioned women in the bible.
The bottom line is that due to the presence of conflicting evidence on both sides, and the fact that this was 2000 years ago, there's no way to actually know. So you can do all the theorycraft you want to into the matter and say you're right. Nobody will be able to prove you wrong.