Question about jTable

0

A quick question, esque I need you to show me all the records related in a jTable with a plate that I have in a database, I could do it but the problem esque only shows one and I need you to show all I've already tried but always shows me only one here the code, so call me all those who have the plate EUU777 in the jTable but even there the other data vary eg date time etc but if the plate is the same then call them all '

try {

DefaultTableModel dfm = new DefaultTableModel();

    JTable tabla;
    tabla = this.jTable1;
    tabla.setModel(dfm);
    dfm.setColumnIdentifiers(new Object[]{"fecha","placa","hora","cascos"});
    Class.forName(driver);
    conx=DriverManager.getConnection(url, user, clave);
    Statement s = conx.createStatement();
    ResultSet rs = s.executeQuery("select * from tickeds_tabla where Placa='"+jTextField1.getText()+"'");
    if(rs.next()){
          dfm.addRow(new Object[]{rs.getString(2),rs.getString(3),rs.getString(4),rs.getString(5)});

    } else {
        JOptionPane.showMessageDialog(null, "Cliente no registrado");
    }
}
catch(ClassNotFoundException e) {
    JOptionPane.showMessageDialog(null, e);
}
catch(SQLException e) {
    JOptionPane.showMessageDialog(null, e);
}

Cita en bloque

'

    
asked by Alejandro Mejia 06.06.2018 в 01:21
source

0 answers