I had that problem once, my alternator wire had come off. Check all the connections under the hood to make sure they're tight.