When an ionic compound dissolves in water, the water molecules surround and separate the ions from each other. This process is called ionization. The ions are then free to move around in the water, and they can carry an electrical charge. This is why ionic compounds can conduct electricity when they are dissolved in water.
Gases, on the other hand, do not conduct electricity. This is because gases do not contain ions. Instead, gases are made up of atoms or molecules that are not electrically charged.