Is DHT produced when you have an erection?

No. Dht (dihydrotestosterone) is produced by 5 Alpha reductase (5ari) converting testosterone. You can stop this from happening by using a 5 Alpha reductase inhibitor such as Finasteride or dutasteride. However, beware that testosterone is also converted into Estradiol (female hormone) so that if you keep it from going down one pathway, it might choose the other.