コード例 #1
0
  @Override
  public boolean actualizarpersona(Persona persona) {
    boolean flat = false;
    String query =
        "UPDATE persona SET nombre='"
            + persona.getNombre()
            + "',apepat='"
            + persona.getApepat()
            + "',apemat='"
            + persona.getApemat()
            + "',sexo='"
            + persona.getSexo()
            + "',dni='"
            + persona.getDni()
            + "',celular='"
            + persona.getCelular()
            + "',direccion='"
            + persona.getDireccion()
            + "' WHERE id_persona ="
            + persona.getId_persona()
            + "";

    try {
      cn.execC(query);
      cn.Commit();

      return true;
    } catch (Exception EX) {
      cn.RollBack();

      return false;
    }
  }
コード例 #2
0
 @Override
 public boolean eliminarpersona(String id_persona) {
   boolean flat = false;
   String query = "DELETE FROM persona WHERE id_persona=" + id_persona + "";
   try {
     cn.execC(query);
     cn.Commit();
     return true;
   } catch (Exception EX) {
     cn.RollBack();
     return false;
   }
 }
コード例 #3
0
  @Override
  public boolean agregarpersona(Persona persona) {
    boolean flat = false;
    Statement st = null;
    String query =
        "INSERT INTO persona (nombre,apepat,apemat,sexo,dni,celular,direccion)"
            + " VALUES('"
            + persona.getNombre()
            + "',"
            + "'"
            + persona.getApepat()
            + "',"
            + "'"
            + persona.getApemat()
            + "',"
            + "'"
            + persona.getSexo()
            + "',"
            + ""
            + persona.getDni()
            + ","
            + ""
            + persona.getCelular()
            + ","
            + "'"
            + persona.getDireccion()
            + "')";
    System.out.println(query);
    try {
      cn.execC(query);
      cn.Commit();

      return true;
    } catch (Exception EX) {
      cn.RollBack();

      return false;
    }
  }