I always take some needle and thread and pin one part through with the needle than wrap around the thread as often as you need and finish it off with a knot - this allows you to connect both strings without any knot in the cord itself!
You can also seal everything up with superglue - this will never come undone!
cheers
Mike