Esempio n. 1
0
        public static void updateEspece(EspeceDAO p)
        {
            string           query       = "UPDATE personne set nom=\"" + p.nomDAO + "\", genre=\"" + p.genreDAO + "\", where idEspece=" + p.idEspeceDAO + ";";
            MySqlCommand     cmd         = new MySqlCommand(query, connection);
            MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd);

            cmd.ExecuteNonQuery();
        }
Esempio n. 2
0
        public static void insertEspece(EspeceDAO p)
        {
            int              id          = getMaxIdEspece() + 1;
            string           query       = "INSERT INTO espece VALUES (\"" + id + "\",\"" + p.nomDAO + "\",\"" + p.genreDAO + "\");";
            MySqlCommand     cmd2        = new MySqlCommand(query, DALConnection.connection);
            MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd2);

            cmd2.ExecuteNonQuery();
        }
Esempio n. 3
0
        public static EspeceDAO getEspece(int idEspece)
        {
            string       query = "SELECT * FROM espece WHERE id=" + idEspece + ";";
            MySqlCommand cmd   = new MySqlCommand(query, connection);

            cmd.ExecuteNonQuery();
            MySqlDataReader reader = cmd.ExecuteReader();

            reader.Read();
            EspeceDAO pers = new EspeceDAO(reader.GetInt32(0), reader.GetString(1), reader.GetString(2));

            reader.Close();
            return(pers);
        }
Esempio n. 4
0
        public static ObservableCollection <EspeceDAO> selectEspece()
        {
            ObservableCollection <EspeceDAO> l = new ObservableCollection <EspeceDAO>();
            string       query = "SELECT * FROM Espece;";
            MySqlCommand cmd   = new MySqlCommand(query, DALConnection.OpenConnection());

            try
            {
                cmd.ExecuteNonQuery();
                MySqlDataReader reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    EspeceDAO p = new EspeceDAO(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);
        }
Esempio n. 5
0
 public static void insertEspece(EspeceDAO p)
 {
     EspeceDAL.insertEspece(p);
 }
Esempio n. 6
0
 public static void updateEspece(EspeceDAO p)
 {
     EspeceDAL.updateEspece(p);
 }
Esempio n. 7
0
        public static EspeceDAO getEspece(int idEspece)
        {
            EspeceDAO p = EspeceDAL.getEspece(idEspece);

            return(p);
        }