@DishingOutDone - the op's dog was off lead and approached the other dogs first.
@adaline
Train more - keep using the longline, practice practice practice - let the line trail, vary your reinforcers, play games where your dog needs to check in, then gradually shorten the trailing line, practice recalling, sending away, recalling, treat, send away..
Vary your location, vary the amount of distraction.
Be more interesting to your dog than other dogs out there, don't walk the same routes day in day out, break it up, you can even simply reverse a route or, walk the other side of the road or play games in different places if you are seriously limited in places to walk.
If your recall cue has been poisoned, ie it now means 'piss about come back if theres nothing better' or 'if you come back now the leads going on, funs over' then change your recall cue.
Change your habits too - if you walk on a beach with not a lot to do except scan the horizon for other dogs to play with/chase/annoy, thats what your dog is going to do.
Make a habit of going on some walks where you walk with friends but NOT off lead, so your dog starts to learn about being around other dogs but NOT playing.
Sometimes its about changing your mindset on what a walk should actually be - many people think a walk should be 'find some other dogs, let my dog off to play, job done'. If you change your walks to be 'an amount of time where I and my dog explore places, work together, play games', you can change that habit!
And some dogs just won't ever be reliable off lead - keep the long line on them, walk in places that are better suited, fewer dogs or at least, less long distance views of other dogs playing.
I use Biothane longlines as these can be left to trail and wiped clean, and don't absorb liquid so don't get steadily heavier and heavier.
Also use a well fitting harness with a Y shaped front NOT a horizontal across the chest front (these impede shoulder movement and will cause damage over time).