Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Id Integer clave primaria auto increment
- numero_socio int
- nombre varchar
- apellidos varchar
- nif varchar
- fecha_nac date
- telefono int
- correo varchar
- direccion varchar
- fecha_alta date
- fecha_baja date
- id clave primaria auto increment
- acta mediumtext
- tipo varchar
- fecha date
- convocante varchar
- id clave primaria auto increment
- id_socio_presidente int (relación con id de un socio)
- id_socio_secretario int (relación con id de un socio)
- id_socio_vocal1 int (relación con id de un socio)
- id_socio_vocal2 int (relación con id de un socio)
- id_socio_vocal3 int (relación con id de un socio)
- id_asamblea int (relación con id de una asamblea)
- periodo varchar
- void cargar(String valor) {
- try {
- String[] titulos = {"Id", "Presidente", "Secretario", "Vocal 1", "Vocal 2", "Vocal 3", "Asamblea", "Periodo",};
- String[] registros = new String[8];
- model = new DefaultTableModel(null, titulos);
- String cons = "SELECT a.fecha AS FechaAsamblea,n"
- + "p.nombre AS NombrePresidente,n"
- + "p.apellidos AS ApellidosPresidente,n"
- + " jd.id,n"
- + " periodo,n"
- + " s.nombre AS NombreSecretario,n"
- + " s.apellidos AS ApellidosSecretario,n"
- + " v1.nombre AS NombreVocal1,n"
- + " v1.apellidos AS ApellidosVocal1,n"
- + " v2.nombre AS NombreVocal2,n"
- + " v2.apellidos AS ApellidosVocal2,n"
- + " v3.nombre AS NombreVocal3,n"
- + " v3.apellidos AS ApellidosVocal3n"
- + "FROM junta_directiva jdn"
- + "INNER JOIN socios p ON jd.id_socio_presidente = p.idn"
- + "INNER JOIN socios s ON jd.id_socio_secretario = s.idn"
- + "INNER JOIN socios v1 ON jd.id_socio_vocal1 = v1.idn"
- + "INNER JOIN socios v2 ON jd.id_socio_vocal2 = v2.idn"
- + "INNER JOIN socios v3 ON jd.id_socio_vocal3 = v3.idn"
- + "INNER JOIN asamblea a ON jd.id_asamblea = a.id";
- Statement st = cn.createStatement();
- ResultSet rs = st.executeQuery(cons);
- //Introducimos los registros de la base de datos en la tabla
- while (rs.next()) {
- registros[0] = rs.getString("jd.id");
- registros[1] = rs.getString("NombrePresidente") + " " + rs.getString("ApellidosPresidente");
- registros[2] = rs.getString("NombreSecretario") + " " + rs.getString("ApellidosSecretario");
- registros[3] = rs.getString("NombreVocal1") + " " + rs.getString("ApellidosVocal1");
- registros[4] = rs.getString("NombreVocal2") + " " + rs.getString("ApellidosVocal2");
- registros[5] = rs.getString("NombreVocal3") + " " + rs.getString("ApellidosVocal3");
- registros[6] = rs.getString("FechaAsamblea");
- registros[7] = rs.getString("periodo");
- model.addRow(registros);
- }
- jTable1.setModel(model);
- } catch (Exception e) {
- System.out.println(e.getMessage());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement