Barium contrast (not water soluble) usually we use it for upper GI study (orally) or lower GI study ( as enema ) because it is available, easy to use, gives good images, rarely cause allergy and cheap.
It is contraindicated if there is perforation ( in case of perforation e.g. duodenal ulcer) or post op. leakage
A barium-based contrast medium is contraindicated in suspected perforation (in case of perforation e.g. duodenal ulcer or post op. leakage), as leakage increases the risk of severe mediastinitis, peritonitis, or pneumonia due chemical peritonitis. in that case we use Gastrografin (water soluble) is predominantly used when perforations or anastomotic leaks are suspected..
Barium examinations of the stomach and colon (and in some cases small bowel) are usually undertaken using a double-contrast technique ( barium + air).
How do I know if there is perforation? - We know it if we see air under the diaphragm in x-ray.