http://www.advancedfertility.com/hsg.htm
This link should explain the procedure pretty well. I hope it answers your question and am sorry you are going through so much difficulty.
I hope I'm understanding this... but if you've had previous m/c or any surgeries in the pelvic cavity, there could be scar tissue, or adhesions anywhere in there. I've had it done twice and there's some speculation that it also helps you become fertile (something with the dye i believe). but hope it helps... Good luck!!