public static void updatePrelevement(PrelevementDAO p) { string query = "UPDATE prelevement set PositionGPS=\"" + p.PositionGPSDAO + "\", Type=\"" + p.TypeDAO + "\", where idprelevement=" + p.idprelevementDAO + ";"; MySqlCommand cmd = new MySqlCommand(query, connection); MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd); cmd.ExecuteNonQuery(); }
public static void insertPrelevement(PrelevementDAO p) { int id = getMaxIdPrelevement() + 1; string query = "INSERT INTO prelevement VALUES (\"" + id + "\",\"" + p.PositionGPSDAO + "\",\"" + p.TypeDAO + "\");"; MySqlCommand cmd2 = new MySqlCommand(query, DALConnection.connection); MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd2); cmd2.ExecuteNonQuery(); }
public static PrelevementDAO getPrelevement(int idprelevement) { string query = "SELECT * FROM prelevement WHERE idprelevement=" + idprelevement + ";"; MySqlCommand cmd = new MySqlCommand(query, DALConnection.connection); cmd.ExecuteNonQuery(); MySqlDataReader reader = cmd.ExecuteReader(); reader.Read(); PrelevementDAO pers = new PrelevementDAO(reader.GetInt32(0), reader.GetString(1), reader.GetString(2)); reader.Close(); return(pers); }
public static ObservableCollection <PrelevementDAO> selectPrelevements() { ObservableCollection <PrelevementDAO> l = new ObservableCollection <PrelevementDAO>(); string query = "SELECT * FROM prelevement;"; MySqlCommand cmd = new MySqlCommand(query, DALConnection.OpenConnection()); try { cmd.ExecuteNonQuery(); MySqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { PrelevementDAO p = new PrelevementDAO(reader.GetInt32(0), reader.GetString(1), reader.GetString(2)); l.Add(p); } reader.Close(); } catch (Exception e) { MessageBox.Show("La base de données n'est pas connectée"); } return(l); }
public static void insertPrelevement(PrelevementDAO p) { PrelevementDAL.insertPrelevement(p); }
public static void updatePrelevement(PrelevementDAO p) { PrelevementDAL.updatePrelevement(p); }
public static PrelevementDAO getPrelevement(int idprelevement) { PrelevementDAO p = PrelevementDAL.getPrelevement(idprelevement); return(p); }