I'm making a small system print a budget by passing the id. The following situation occurs; By netBeans I pass the id when prompted and the normal report appears.
ButwhenIdogeneratethereportthroughmyprogramitlookslikethis:
Mymethodthatgeneratesthereport:
publicvoidimprimeRelatorio(){ConexaoMySqlco=newConexaoMySql();co.setUrl("jdbc:mysql://localhost:3306/poc");
co.setUsuario("root");
co.setSenha("");
String src = "C:\Users\Administrador\Documents\Eduardo\ControleOrcamento\src\vendas\orcamento.jasper";
Map<String, Object> parametros = new HashMap<String, Object>();
parametros.put("id", (Integer.parseInt(inpId.getText())));
JasperPrint jasperPrint = null;
try {
jasperPrint = JasperFillManager.fillReport(src, parametros, co.getConnection());
} catch (JRException ex) {
Logger.getLogger(TelaControle.class.getName()).log(Level.SEVERE, null, ex);
}
JasperViewer view = new JasperViewer(jasperPrint, false);
view.setVisible(true);
}