When electricity is passed through sodium chloride solution in which carbon rod is immersed hydrogen and chlorine gas are produced. It is an ionic compound. In the second when electricity is passed through sugar solution there is no charge.
Hence it belongs to covalent compound.