Esempio n. 1
0
        public DataTable FormatoCCreate(ModeloFormatoC objCrear)
        {
            var       mysql = new DBConnection.ConexionMysql();
            DataTable dt    = new DataTable();

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

            consulta.Fill(dt);
            mysql.CerrarConexion();
            return(dt);
        }
Esempio n. 2
0
        public Boolean FormatoCUpdate(ModeloFormatoC o, int id)
        {
            var mysql = new DBConnection.ConexionMysql();

            query = String.Format("SET SQL_SAFE_UPDATES=0; " +
                                  "UPDATE admin_formato_c SET nombre = '{0}', idpadre = '{1}' WHERE idformato_c = '{2}'",
                                  o.nombre, o.idpadre, id);

            try
            {
                mysql.AbrirConexion();
                MySqlCommand cmd = new MySqlCommand(query, mysql.conectar);
                cmd.ExecuteNonQuery();
                mysql.CerrarConexion();
                return(true);
            }
            catch
            {
                return(false);
            }
        }