We have all heard the expression "no pain, no gain" and when it is related to the fitness world I think it is not only over used, but often misunderstood.
While it is true that the post workout soreness know as delayed onset muscle soreness (DOMS) is a normal conclusion to a strenuous workout, sharp pain experienced during a workout means something else entirely.
DOMS occurs post workout and can take up to 48 hours to manifest, and this is the good kind of sore. It means your muscles are building stronger versions of themselves. Now if you feel a sharp pain while exercising, this is your body's way of communicating with you that you are doing something it doesn't like. Your body wants and needs you to stop. Listen to this pain, chances are high it is in some joint or your lower back area.
If you are strength training, stop and check your technique. Try the motion again a little more slowly and thoughtfully. Same pain? Then try the motion smaller. Same pain? Stop. You experimented with your options, so stopping does not mean wimping out. If you work with a trainer ask them to watch your form or suggest a similar exercise to try. The sharp pain generally means you are injuring the tissues in your joint, and trust me you don't want to damage your soft tissues.
All that being said, to get stronger you do have to push yourself and getting close to maximal effort is going to feel taxing. You have to learn by trial and error, when to push yourself, when to ease up and when to stop.