I would suggest seeing your doctor
or going to the emergency room if the pain is severe and if there was a recent injury, as you would want to rule out any broken bone. This is especially important if the area is deformed in any way or appears very swollen.
However, if the pain is not very severe and there is no serious swelling or deformity, then your are probably just suffering from a mild strain or sprain of the wrist. Treatment for these injuries is very conservative, meaning that you usually just wait for the pain to take care of itself over time. Things that can help include rest, especially avoiding activities which make the pain worse, elevation if there is swelling, icing, and antiinflammatory medications like ibuprofen or naprosyn. In most cases, these treatments will clear up the pain within a matter of a few days to week.
If, however, the pain persists or worsens or if you also notice any numbness or tingling
in your fingers then you should get in to see your primary care doctor
to determine if there is a more serious problem which needs attention.