It's every photo-taker's nightmare: After taking loads of precious pictures, your memory card is completely toasted. Digital Photography School offers several tips for reducing the likelihood of memory card corruption.
Formatting your new card before you use it is one of the most important ones. Even if the card says it's pre-formatted or ready for use, there's a chance it wasn't or might not work with your camera.
Additionally, when snapping away, make sure your don't fill the card up completely or let your camera battery die. Either of these could cause write errors and possibly corrupt the whole card.
Check out the article below for more memory card maintenance tips.
How to Keep Your Memory Cards Healthy [Digital Photography School]