Do you have a Multimeter?
If so, you can check the Barrel plug at the End of the Cable, while wiggling it... So you can find out if its the Cable or the Plug. If you get inconstistent readings, you may have a break in your Cable. But most of the time, its the the receiving side on the Device. Usually, most of them tend to loose contact to the PCB. Sometimes you can "temporarily" fix it, by resoldering the Jack. In my old Repair Shop, we tended to use Chassis mounted Jacks and soldered a wire to the Mainboard of the Laptop.
I do not believe, that that is an option with newer Models though. They are much slimmer and usually the Space you would need for something like this, just isn't there.
What kind of Laptop - Model is it?
DeKu