Topic: 水晶报表参数传递问题,用过的朋友请进,谢谢 |
Print this page |
1.水晶报表参数传递问题,用过的朋友请进,谢谢 | Copy to clipboard |
Posted by: borlandjb Posted on: 2004-12-27 14:10 我用的是jbx自带的水晶报表,建立好一个报表后(test.rpt),按照JBX帮助建立一下程序: IReportSourceFactory2 rptSrcFactory = new JPEReportSourceFactory(); String report = "test.rpt"; Fields fields = new Fields(); ParameterField pfield1 = new ParameterField(); ParameterField pfield2 = new ParameterField(); ParameterField pfield3 = new ParameterField(); Values vals1 = new Values(); Values vals2 = new Values(); Values vals3 = new Values(); ParameterFieldDiscreteValue pfieldDV1 = new ParameterFieldDiscreteValue(); ParameterFieldDiscreteValue pfieldDV2 = new ParameterFieldDiscreteValue(); ParameterFieldDiscreteValue pfieldDV3 = new ParameterFieldDiscreteValue(); pfield1.setName("czr"); pfieldDV1.setValue("0101"); java.sql.Date ksrq = java.sql.Date.valueOf("2004-10-20"); pfield2.setName("ksrq"); pfieldDV2.setValue(ksrq); java.sql.Date jsrq = java.sql.Date.valueOf("2004-12-20"); pfield2.setName("jsrq"); pfieldDV2.setValue(jsrq); vals1.add(pfieldDV1); vals2.add(pfieldDV2); vals3.add(pfieldDV3); pfield1.setCurrentValues(vals1); pfield2.setCurrentValues(vals2); pfield3.setCurrentValues(vals3); fields.add(pfield1); fields.add(pfield2); fields.add(pfield3); IReportSource reportSource = (IReportSource) rptSrcFactory.createReportSource(report, request.getLocale()); ConnectionInfos connInfos = new ConnectionInfos(); IConnectionInfo connInfo1 = new ConnectionInfo(); connInfo1.setUserName(getdata.username); connInfo1.setPassword(getdata.passwd); connInfos.add(connInfo1); CrystalReportViewer viewer = new CrystalReportViewer(); viewer.setReportSource(reportSource); viewer.setParameterFields(fields); viewer.setEnableParameterPrompt(false); viewer.setDatabaseLogonInfos(connInfos); reportSource.refresh(); viewer.setEnableLogonPrompt(false); viewer.processHttpRequest(request, response, getServletConfig().getServletContext(), out); viewer.dispose(); 结果报错说: com.crystaldecisions.report.web.viewer.CrystalReportViewerSome parameters are missing values 为什么我的参数没有传过去??? 我该怎么做?哪里错了?还是什么其他原因?? 谢谢高手们帮忙,谢谢了!!!!!! |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |