예제 #1
0
        public bool UpdateLiga(Liga l)
        {
            MySqlConnection Conexion = new MySqlConnection();
            MySqlCommand    Query    = new MySqlCommand();
            MySqlDataReader consulta;

            AbrirConexionSql(Conexion);
            //
            Query.CommandText = "UPDATE LIGAS SET CAMPEON_ACTUAL=" + l.getUltimoCampeon() + " WHERE ID=" + l.getId() + ";";
            Query.Connection  = Conexion;
            consulta          = Query.ExecuteReader();

            Conexion.Close();
            return(true);
        }
예제 #2
0
        public bool NuevaLiga(Liga liga)
        {
            MySqlConnection Conexion = new MySqlConnection();
            MySqlCommand    Query    = new MySqlCommand();
            MySqlDataReader consulta;

            AbrirConexionSql(Conexion);
            //Insertar aqui...
            if (liga.getUltimoCampeon() == 0)
            {
                Query.CommandText = "INSERT INTO LIGAS(NOMBRE) VALUES ('" + liga.getNombre() + "');";
            }
            else
            {
                Query.CommandText = "INSERT INTO LIGAS(NOMBRE,CAMPEON_ACTUAL) VALUES ('" + liga.getNombre() + "','" + liga.getUltimoCampeon() + "');";
            }

            Query.Connection = Conexion;
            consulta         = Query.ExecuteReader();

            Conexion.Close();
            return(true);
        }