I had prostate surgery but I am having a difficult time to to maintain an erection and ejaculate.
What kind of prostate surgery did you have? If you had a radical prostatectomy for the treatment of prostate cancer, "the ability for sexual intercourse recovers in about a third of patients at 3 years and nearly 60% at 5 years after surgery. (Rates vary depending on certain factors, such as the patient's age -- the younger the better.)"
Some studies have shown that Viagra can help men achieve an erection after prostatectomy.