anshukunal Posted October 7, 2010 Share Posted October 7, 2010 Hi, How to pass parameters in the sql query in the jasper report via java code.I am attaching codes which i am using. Code:.jrxml file<parameter name="REPORT_PARAMETERS" class="java.lang.String"/> <parameter name="REPORT_PARAMETER" class="java.lang.String"/> <queryString> <![CDATA[select * from Info_Log where $P{REPORT_PARAMETERS}=$P{REPORT_PARAMETER}]]> </queryString>This code didn't worked.Then i tried :<![CDATA[select * from Info_Log where $P!{REPORT_PARAMETERS}=$P!{REPORT_PARAMETER}]]>This gave some sql error.I am able to generate the report passing one parameter in sql query but not with 2 parameters at the same time.<![CDATA[select * from Info_Log where NAME=$P{REPORT_PARAMETER}]]> </queryString>my java code for taking parameters is:Map parameters = new HashMap(); parameters.put ("REPORT_PARAMETERS","reader"); parameters.put("REPORT_PARAMETER","reader1"); JasperPrint jasperPrint = JasperManager.fillReport(jasperReport,parameters, connection); Link to comment Share on other sites More sharing options...
anshukunal Posted October 20, 2010 Author Share Posted October 20, 2010 Issue got fixed. Link to comment Share on other sites More sharing options...
coolabhaymishra Posted March 13, 2013 Share Posted March 13, 2013 please explain how?? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now