Is there any syntax error in this code or query because i am not getting the required report? I have created a JFrame with JDatechoosr. When i select the dates and click view report, it gives me empty report while i know there is data within the specified date range. Kindly help me.
try{
JasperDesign jd = JRXmlLoader.load("Purchase.jrxml");
String sql = "select * from purchase where purchase_date between "
+ "'"+DateChooser_frm.getDate().toString()+"' and '"+DateChooser_to.getDate().toString()+"'";
JRDesignQuery query = new JRDesignQuery();
query.setText(sql);
jd.setQuery(query);
JasperReport jr = JasperCompileManager.compileReport(jd);
JasperPrint jp = JasperFillManager.fillReport(jr, null,con);
JasperViewer.viewReport(jp,false);
}
catch(JRException ex){
JOptionPane.showMessageDialog(null, ex);
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
}