Default my XZ won't have stable connection to pc

My xz is charging in the wall charger normally but when I plugged it to my laptop it will connect.for.a.second and will disconnect.right away, sometimes it shows the notification of being connected to.dock even if I don't have a dock. Now I can't root my phone since it will disconnect-reconnect . I tried to uninstall everything,.I reformatted my laptop and install the pic. I did also the suspect repair and even the flashtool.. Btw if I will connect it in flashtool, the flashtool will recognize it and I can flash fw, unlike if it is on, the problem will appear. I also tried changing the usbftsetting but still failed


Things that I have tried
Reformat my laptop. Did a fresh installation
Change usb settings
Tried my usb to other phone and it worked normally
Change ports.failed
Switched back and forth from different ftf ROM
ROMS
It made me wonder why does the my xz works in flashtool.with flashtool but not while it is on, it doesn't have a stable connection to the laptop