Beispiel #1
0
        public bool remover(Empregado empregado)
        {
            try
            {
                MySqlConnection con = getConnection();
                con.Open();
                MySqlCommand cmd = new MySqlCommand("delete from empresa.empregados where id=?id", con);
                cmd.Parameters.Add(new MySqlParameter("id", empregado.id));

                MySqlDataReader reader;
                reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                }
                con.Close();
                return(true);
            }
            catch (Exception ex)
            {
                Console.Write(ex.Message);
                return(false);
            }
        }