First, rinse your mouth with warm water and use dental floss to try to remove any particles that might be stuck between your teeth. Never apply aspirin or another analgesic, since it burns the tissues rather than healing them.
Second, go to the nearest dentist right away, since sudden sharp pain is generally a bad sign. In most cases, there is an infection.
Also, if you think that the pain or swelling is the result of dental treatment you have just received (e.g. whitening, extraction of a wisdom tooth), do not hesitate to contact our dental centre!