I have found sending the boarding passes in after flying to the respective frequent flyer programs is the easiest way to correctly credit the miles to the desired programs.
Also, I have had ticket counter agents and lounge agents enter my frequent flyer number without telling me when noticing my number is not in the record. For example, going to the Lufthansa lounge using my United card, when I wanted the miles credited to Air Canada. Fortunately I have always been able to get this corrected afterwards (when large mileage bonuses were at stake).