Advertisement
Guest User

Untitled

a guest
Aug 14th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. public void imprimeRelatorio() {
  2.  
  3. ConexaoMySql co = new ConexaoMySql();
  4. co.setUrl("jdbc:mysql://localhost:3306/poc");
  5. co.setUsuario("root");
  6. co.setSenha("");
  7. String src = "C:\Users\Administrador\Documents\Eduardo\ControleOrcamento\src\vendas\orcamento.jasper";
  8.  
  9.  
  10. Map<String, Object> parametros = new HashMap<String, Object>();
  11. parametros.put("id", (Integer.parseInt(inpId.getText())));
  12.  
  13.  
  14.  
  15. JasperPrint jasperPrint = null;
  16. try {
  17. jasperPrint = JasperFillManager.fillReport(src, parametros, co.getConnection());
  18. } catch (JRException ex) {
  19. Logger.getLogger(TelaControle.class.getName()).log(Level.SEVERE, null, ex);
  20. }
  21. JasperViewer view = new JasperViewer(jasperPrint, false);
  22. view.setVisible(true);
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement