I'm designing a board for an industrial product that has a lifetime of more than 20 years, the product housing is sealed. which is better for ultrasonic transceivers connection to the board, to use connectors or solder the sensor wires directly to pads on the board?
The answer is... it depends.
If there is any danger the connector may vibrate loose or otherwise corrode and lose contact, definitely go with a soldered connection.
Since the product is sealed, then, on the face of it, soldered seems like the cheaper choice.
However, you need to factor in assembly/labor costs. If your wiring harness is mass produced it will probably be cheaper to include crimped connectors on the harness rather than have someone solder and strain relief the wires to the board.
In a well designed product, the internal wiring is built on it's own on a jig as a harness and simply dropped into the box and affixed with tie-wraps or clips and quickly attached to where it needs to go.
Which method is ultimately cheaper in your application, is, of course, in your wheelhouse, and can not be answered here.