public static void deletedPlageEtude(DAOPlageEtude plageEtude) { string query = "DELETE FROM plage_has_etude WHERE etude_idEtude = \"" + plageEtude.idEtude + "\" AND plage_idPlage =\"" + plageEtude.idPlage + "\";"; MySqlCommand cmd = new MySqlCommand(query, connection); MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd); cmd.ExecuteNonQuery(); }
public static void updatePlageEtude(DAOPlageEtude plageEtude) { string query = "UPDATE plage_has_etude set plage_idPlage=\"" + plageEtude.idPlage + "\" where etude_idEtude=" + plageEtude.idEtude + ";"; MySqlCommand cmd = new MySqlCommand(query, connection); MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd); cmd.ExecuteNonQuery(); }
public static void insertPlageEtude(DAOPlageEtude plageEtude) { string query = "INSERT INTO plage_has_etude ( `plage_idPlage`,`etude_idEtude`) VALUES (\"" + plageEtude.idPlage + "\",\"" + plageEtude.idEtude + "\");"; MySqlCommand cmd2 = new MySqlCommand(query, connection); MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd2); cmd2.ExecuteNonQuery(); }
public static ObservableCollection <DAOPlageEtude> listePlageEtude() { ObservableCollection <DAOPlageEtude> l = new ObservableCollection <DAOPlageEtude>(); string query = "SELECT * FROM plage_has_etude;"; MySqlCommand cmd = new MySqlCommand(query, connection); cmd.ExecuteNonQuery(); MySqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { DAOPlageEtude c = new DAOPlageEtude(reader.GetInt32(0), reader.GetInt32(1)); l.Add(c); } reader.Close(); return(l); }