Guest User

Untitled

a guest
Oct 16th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. try{
  2. String sql = "Select descripcion,precio from detalle_factura_compra where factura="+Integer.parseInt(txtFactura.getText());
  3. PreparedStatement ps = con.conexion().prepareStatement(sql);
  4. try (ResultSet res = ps.executeQuery()) {
  5. Object datos[]= new Object[2];
  6. while(res.next()){
  7. for (int i = 0;i<2;i++){
  8. datos[i]= res.getObject(i+1);
  9. }
  10. modeloTabla.addRow(datos);
  11. }
  12. }
  13. } catch (SQLException ex) {
  14. Logger.getLogger(Consulta_Cliente.class.getName()).log(Level.SEVERE, null, ex);
  15. ex.printStackTrace();
  16. }
Add Comment
Please, Sign In to add comment