Ejemplo n.º 1
0
  private void jButton1ActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton1ActionPerformed
    conexioninicio ci = new conexioninicio();
    Connection con = null;

    try {
      Class.forName("org.gjt.mm.mysql.Driver");
      con = DriverManager.getConnection(ci.getURl(), ci.getLogin(), ci.getPassword());
      Statement stmt = con.createStatement();
      String cadenasql =
          "select nombre,apPat,apMat,calle,numExt,colonia,municipio,cp,email,numTel,curp,idadmon,contraseña,nombreest from persona natural join admin natural join estado where idadmon="
              + "'"
              + User
              + "'";
      ResultSet rs = stmt.executeQuery(cadenasql);
      while (rs.next()) {
        nombre.setText(rs.getString("nombre"));
        apPat.setText(rs.getString("apPat"));
        apMat.setText(rs.getString("apMat"));
        calle.setText(rs.getString("calle"));
        num.setText(rs.getString("numExt"));
        colonia.setText(rs.getString("colonia"));
        municipio.setText(rs.getString("municipio"));
        cp.setText(rs.getString("cp"));
        email.setText(rs.getString("email"));
        telefono.setText(rs.getString("numTel"));
        curp.setText(rs.getString("curp"));
        idamin.setText(rs.getString("idadmon"));
        contraseñaactual.setText(rs.getString("contraseña"));
        this.jComboBox1.setSelectedItem(rs.getString("nombreest"));
      }
    } catch (Exception e) {
      System.out.println(e.getMessage());
    } // TODO add your handling code here:
  } // GEN-LAST:event_jButton1ActionPerformed
Ejemplo n.º 2
0
  private void jButton3ActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton3ActionPerformed
    conexioninicio ci = new conexioninicio();
    Connection con = null;
    Connection con1 = null;

    try {
      Class.forName("org.gjt.mm.mysql.Driver");
      con = DriverManager.getConnection(ci.getURl(), ci.getLogin(), ci.getPassword());
      con1 = DriverManager.getConnection(ci.getURl(), ci.getLogin(), ci.getPassword());
      Statement stmt = con.createStatement();
      Statement stmts = con1.createStatement();
      String cadenasql =
          "UPDATE persona  SET nombre="
              + "'"
              + nombre.getText().toUpperCase()
              + "'"
              + ","
              + "apPat="
              + "'"
              + apPat.getText().toUpperCase()
              + "'"
              + ","
              + "apMat="
              + "'"
              + apMat.getText().toUpperCase()
              + "'"
              + ","
              + "calle="
              + "'"
              + calle.getText().toUpperCase()
              + "'"
              + ","
              + "colonia="
              + "'"
              + colonia.getText().toUpperCase()
              + "'"
              + ","
              + "numExt="
              + num.getText()
              + ","
              + "municipio="
              + "'"
              + municipio.getText().toUpperCase()
              + "'"
              + ","
              + "numTel="
              + "'"
              + telefono.getText()
              + "'"
              + ","
              + "cp="
              + "'"
              + cp.getText()
              + "',"
              + "curp="
              + "'"
              + curp.getText().toUpperCase()
              + "',"
              + "idestado="
              + "'"
              + jComboBox1.getSelectedIndex()
              + "',"
              + "email="
              + "'"
              + email.getText()
              + "' where curp = '"
              + curp.getText()
              + "'";

      String cadenasql2 =
          "UPDATE admin  SET idadmon="
              + "'"
              + idamin.getText()
              + "',curp="
              + "'"
              + curp.getText().toUpperCase()
              + "' where curp = '"
              + curp.getText()
              + "'";

      stmt.executeUpdate(cadenasql);
      stmts.executeUpdate(cadenasql2);
      //   System.out.print("Se han borrado todos los datos");

      JOptionPane.showMessageDialog(this, "ActualizaCION Exitosa");
    } catch (Exception e) {
      System.out.println(e.getMessage());
    } // TODO add your handling code here:
  } // GEN-LAST:event_jButton3ActionPerformed