你好朋友我试图从 jasper 报告中调用 sql server store 过程,但我得到这个错误:- .sf.jasperreports.engine.JRException:执行 SQL 语句时出错:ReportTemplate 我不知道出了什么问题,请帮助我。从这里我调用程序:-
<parameter name="param1" class="java.lang.Integer"/>
<parameter name="param2" class="java.lang.Integer"/>
<parameter name="param3" class="java.lang.String"/>
<parameter name="param4" class="java.lang.String"/>
<queryString>
<![CDATA[Call P_SubLedger_Report($P{param1},$P{param2},$P{param3},$P{param4});]]>
</queryString>
这是我的java函数:
public byte[] getSubledgerReport(String strtdate,String enddate,int acid, int subacid)throws Exception{
SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy");
Date parsedstrtdate = format.parse(strtdate);
java.sql.Date stdate = new java.sql.Date(parsedstrtdate.getTime());
Date parsedenddate = format.parse(enddate);
java.sql.Date enddt = new java.sql.Date(parsedenddate.getTime());
System.out.println("yaha aaya bhi"+stdate+" "+acid+" "+subacid);
JasperReport jasperReport = null;
JasperPrint jasperPrint = null;
byte[] bytes = null;
Map parameters = new HashMap();
try {
parameters.put("param1", acid);
parameters.put("param2", subacid);
parameters.put("param3", stdate);
parameters.put("param4", enddt);
//String reportSource = "C:\\Users\\Subodh\\Desktop\\Teachers\\src\\DB\\Account\\AccountsReport\\newReport.jrxml";
String reportSource = "C:\\Users\\subodh\\Desktop\\Bipin\\SSSML\\src\\java\\AccountReports\\SubLedgerReport.jrxml";
jasperReport = (JasperReport) JasperCompileManager.compileReport(reportSource);
bytes = JasperRunManager.runReportToPdf(jasperReport, parameters, conn);
} catch (JRException e) {
System.out.println("Error is kjsdhgjkshdgjkhg"+e);
}
conn.close();
return bytes;
}