private void btnPrestarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPrestarActionPerformed
        String text = txtBuscar.getText().toString();
        ArrayList<Libros> rows = new ArrayList<>();
        LibrosCRUD pdao =  new LibrosCRUD(MyConnection.getConnection());
        Libros lib;
        if(jTable1.getModel().getValueAt(
            jTable1.getSelectedRow(), 2)==jTable1.getModel().getValueAt(
            jTable1.getSelectedRow(), 3)){
            JOptionPane.showMessageDialog(this, "Este Libro se encuentra en prestamo");
        }else{
            Libros lb = (Libros) jTable1.getModel().getValueAt(jTable1.getSelectedRow(), 4);
            PrestamosCRUD p = new PrestamosCRUD(MyConnection.getConnection());
            Calendar cal = Calendar.getInstance();
            Prestamos pnew =  new Prestamos(0, new Date(cal.getTimeInMillis()), "pendiente", lb.getCodigolibro(), MenuPrincipalViews.user.getCodigo());
            if(p.add(pnew)){
                LibrosCRUD crud = new LibrosCRUD(MyConnection.getConnection());
                crud.updatePrestado(lb);
                JOptionPane.showMessageDialog(this, "Prestamo registrado correctamente!!!");
                if(text.isEmpty()){
                    rows = pdao.getAll();
                }else{
                    lib = new Libros("", text, "", "", 0);
                    String option = jComboBox1.getSelectedItem().toString();
                    switch(option){
                        case "Por Nombre":
                            rows = pdao.getByNombre(lib);
                            break;

                        case "Por Autor":
                            rows = pdao.getByAutor(lib);
                            break;
                    }
                }
                volcarDatos(rows);
            }
            //volcarDatos(usuarios);
        }
    }//GEN-LAST:event_btnPrestarActionPerformed