public DataTable BrechaCreate(ModeloBrecha objCrear)
        {
            var       mysql = new DBConnection.ConexionMysql();
            DataTable dt    = new DataTable();

            query = String.Format("INSERT INTO admin_brecha (nombre)" +
                                  "VALUES('{0}');",
                                  objCrear.nombre_brecha);
            mysql.AbrirConexion();
            MySqlDataAdapter consulta = new MySqlDataAdapter(query, mysql.conectar);

            consulta.Fill(dt);
            mysql.CerrarConexion();
            return(dt);
        }
Пример #2
0
        public Boolean UpdateBrecha(ModeloBrecha objEditar, int id)
        {
            var mysql = new DBConnection.ConexionMysql();

            query = String.Format("SET SQL_SAFE_UPDATES=0; " +
                                  "UPDATE admin_brecha SET nombre = '{0}' WHERE idbrecha = '{1}';",
                                  objEditar.nombre_brecha, id);
            try
            {
                mysql.AbrirConexion();
                MySqlCommand cmd = new MySqlCommand(query, mysql.conectar);
                cmd.ExecuteNonQuery();
                mysql.CerrarConexion();
                return(true);
            }
            catch
            {
                return(false);
            }
        }