Ant control products are available in various forms:

Ant Baits - Insecticide Concentrates - Insecticide Dusts - Aerosol Sprays

When ant baits are used, the ants do the work for you -- carrying the baited material back to the colony where it is shared, killing the entire colony.  But not all ants will accept baits, either due to their feeding habits or the size of the ant.  If ant baits kill the foraging workers before they can share the food with the colony, the entire colony recognizes this and will stop feeding on your bait.
In order to get rid of ants in and around buildings, choose the best product for the job.  Knowing which ant species is your pest goes a long way in controlling them.  (See Ant Index for list of common ants and their control.)

Pharaoh Ants are best controlled using an ant bait that is labeled for that particular ant.  Contact insecticides (sprays and dusts) tend to make Pharaoh ant problems worse.  Use a good ant bait for Pharaoh ant control.
Crazy Ants can sometimes be controlled with bait but most infestations are best dealt with by using a combination of sprays and dust.  This combination hits the ants where they are hiding.
Carpenter Ants -- Products used to control carpenter ants in and around homes and buildings.  Carpenter ants can be controlled with either carpenter ant baits or contact insecticides.
Baits include both granular and gel formulations.
Contact insecticides include dust and spray formulations.
Using contact insecticides gives you the advantage of controlling numerous pests in and around the home.
Baiting for carpenter ants is a more targeted approach that is pest specific.  Ant baits work especially well in infestations where the exact location of the colony is not known.
Granular baits and bait gel can be combined.  Insecticide sprays and insecticide dusts can be combined.
Do not combine baits with contact insecticide sprays or dusts as this will contaminate your bait, making it unattractive to ants.