I have a problem when I want to update a Jtable, when I click on the insert button, the entered data should appear in the table but nothing appears.
this what I have in the insert button Detail:
insertar ins = new insertar();
ins.insdetfactcompra(Integer.parseInt(txtFactura.getText()),txtDescripcion.getText(),Float.parseFloat(txtPrecio.getText()));
float precio = Float.parseFloat(txtPrecio.getText());
txtDescripcion.setText("sin descripcion");
txtPrecio.setText("0.00");
total = total + precio;
txtTotal.setText(Float.toString(total));
modeloTabla.setRowCount(0);
try{
String sql = "Select descripcion,precio from detalle_factura_compra where factura="+Integer.parseInt(txtFactura.getText());
PreparedStatement ps = con.conexion().prepareStatement(sql);
try (ResultSet res = ps.executeQuery()) {
Object datos[]= new Object[2];
while(res.next()){
for (int i = 0;i<2;i++){
datos[i]= res.getObject(i+1);
}
modeloTabla.addRow(datos);
}
}
} catch (SQLException ex) {
Logger.getLogger(Consulta_Cliente.class.getName()).log(Level.SEVERE, null, ex);
ex.printStackTrace();
}