Writing dialogue is very important in stories and novels. If a story has badly written dialogue, we as readers can get lost and loose interest very quickly. Even the way the dialogue is presented to the reader is important. I highly recommend reading Ernest Hemingway's Hills Like White Elephants (link below). This story is based around dialogue and is a great learning tool. You can see how to use dialogue tags, and how often you should. While this story is not erotica in any way, it should be read by anyone who desires to write. I've included several websites which go into more detail on how to write dialogue and it's importance in your story.
Links
Hills Like White Elephants
If your Dialogue fails, so will your story
Top 8 Tips for Writing Dialogue
Punctuating Dialogue