public void Agregar(Cancion c) { comando = new MySqlCommand(String.Format("select count(*) from cancion where nombre='{0}'", c.NombreCancion), conexion); int resultado = Convert.ToInt32(comando.ExecuteScalar()); if (resultado > 0) { throw new ArgumentException("Esta canciĆ³n ya se encuentra registrada."); } comando.CommandText = string.Format("insert into cancion(nombre, duracion, album, idCategoria, idArtista) values('{0}','{1}','{2}',{3},{4})", c.NombreCancion, c.Duracion, c.Album, c.IdCategoria, c.IdArtista); comando.ExecuteNonQuery(); ListaCanciones.Add(c); }