3 sets of wires in junction box
Replaced ceiling fan with a light fixture. Each set of wires had 1 black, 1 neutral, 1 ground. The fan was wired as follows. Two black and the neutral from the hot black together, 2 neutral together, and the wires from the fan were all connected to the remaining hot black. After I removed the fan, I connected the light as follows: I removed the 1 neutral that was previously connected to the 2 black and attached it to the white from the light. I recapped the 2 black together. I left the other 2 neutral as they previously were. I connected the hot black to the black from the light. I then replaced the wall dimmer switch with a singe toggle (on/off) switch. When I turned the circuit breaker back on, the light was on, but I could no turn it off at the switch. Also, the light in the next room would not come on.
How should they be wired? Thank you, Phil Harris (Oklahoma Grandpa)