public int Update(ArrayList<QueryCriteria> criteria, HashMap<String, String> fields) {
        this.DBConn = new DBHelper();
        String whereClause = "", fieldsStr = "", QueryStr;

        for (int i = 0; i < criteria.size(); i++) {
            if (!whereClause.equals("")) {
                whereClause += "and";
            }
            whereClause += criteria.get(i).formatCriteria();
        }
        Iterator<Map.Entry<String, String>> it = fields.entrySet().iterator();
        while (it.hasNext()) {
            if (!fieldsStr.equals("")) {
                fieldsStr += " , ";
            }
            Map.Entry<String, String> m = it.next();
            fieldsStr += "`" + m.getKey() + "`='" + m.getValue() + "'";
        }
        if (whereClause.equals("")) {
            whereClause = "1";
        } 
        QueryStr = "Update " + this.table + " SET " + fieldsStr + " WHERE " + whereClause + ";";
        int result = this.DBConn.executeUpdate(QueryStr);
        try {
            this.DBConn.conn.close();
        } catch (SQLException ex) {
            Logger.getLogger(CRUD.class.getName()).log(Level.SEVERE, null, ex);
        }
        return result;

    }