Ejemplo n.º 1
0
        public M_Plane Recherche_plane(int id)
        {//recherche les données ad'un avion associé à son id donné en parametre
            connection.Open();

            MySqlCommand command = connection.CreateCommand();

            command.CommandText = "select * from Plane where id=@ln"; // exemple de requete bien-sur !
            command.Parameters.AddWithValue("@ln", id);

            MySqlDataReader reader1;

            reader1 = command.ExecuteReader();
            //parcours deux fois la ligne donc va au resultat de la deuxieme ligne de la colonne 0
            /* exemple de manipulation du resultat */
            int    ido    = 0;
            string name   = "";
            string avion  = "";
            int    length = 0;
            int    width  = 0;

            while (reader1.Read())
            {
                ido    = reader1.GetInt32(0);
                name   = reader1.GetString(1);
                avion  = reader1.GetString(2);
                length = reader1.GetInt32(3);
                width  = reader1.GetInt32(4);
            }
            M_Plane plane = new M_Plane(ido, name, avion, length, width);

            connection.Close();
            return(plane);
        }
Ejemplo n.º 2
0
 public MV_Plane(M_Plane avion)
 {
     this.avion = avion;
 }