First of all, analyze the nature of the pain.
Situation 1: cold, hot, sour and sweet stimulation pain.
The main consideration is deep caries, which has not injured the pulp, then you need to remove the caries (digging out the black), and fill it directly after appeasement treatment.
Situation 2: Pain after eating.
Also consider deep caries, not leaking the pulp, due to food embedded in the cavity fermentation of acid production, stimulation of the pulp. Treatment is the same as above.
Situation 3: spontaneous pain, i.e., do not touch it by itself, night pain aggravated, the pain is often on one side, do not feel the exact location of the pain.
The main consideration is pulpitis, which needs to be treated by drilling (open pulp drainage), followed by root canal treatment, and finally filling.
Situation 4: Occlusal pain, i.e. pain when eating, afraid to bite. Can localize when in pain.
The main consideration is periapical inflammation, the method is the same as case 3.
Case 5: pain caused by wisdom teeth.
It can be pain from a long wisdom tooth squeezing a neighboring tooth, or it can be pain caused by pericoronitis of the wisdom tooth.
Either way, it is recommended that you go to a dental specialist in a timely manner for treatment, and the effect of just taking medication is very limited (taking painkillers does not control the condition). Situation 1234 are in increasing order of the degree of lesions, so timely treatment in order not to worsen the situation.