Shaykh ‘Abd al-‘Azeez ibn Baaz (May Allaah have mercy on him) was asked,
If a person suffers pain in his teeth and he goes to the dentist who cleans them or does a filling or extracts one of his teeth, does that affect his fast? If the dentist gives him an injection to anaesthetize his tooth, does that affect his fast?
The things mentioned in this question doe not have any effect on the validity of the fast, rather that is allowed. But he has to be careful not to swallow any medicine or blood. Similarly, the injection mentioned does not affect the validity of the fast because it is not a kind of food or drink, and the basic principle is that his fast is valid. (Ajwabah Muhimmah tata’allaq bi Arkaan al-Islam).
If you can go to the dentist in the evening, this is preferable.
And Allaah knows best.