JSP code to pass RecordSet in Crystal Report XI
I am new to JSP programming, and one of my client requirement is to use crystal report in JSP. I wan开发者_开发问答t to pass a recordset into the crystal report through jsp code. Any help would be highly appriciated.
Thanks, Yogi
I am able to solve this issue however when I pass resultset which has WHERER condition in sql statement or even resultset genereated from Stored Proc not data will be populated on the crystal report below is the code which I used to pass resultset in crystal report.
conn = ds.getConnection();
Statement stmt = conn.createStatement();
String query = "SELECT \"My1099_tbl1099M\".\"PAYERS_NAME_ADDR_1\", \"My1099_tbl1099M\".\"PAYERS_NAME_ADDR_2\", \"My1099_tbl1099M\".\"PAYERS_NAME_ADDR_3\", \"My1099_tbl1099M\".\"PAYERS_NAME_ADDR_4\", \"My1099_tbl1099M\".\"PAYERS_NAME_ADDR_5\" " +
// "FROM \"AcctOps1099\".\"dbo\".\"My1099_tbl1099M\" ";
resultSet = stmt.executeQuery(query);
resultSet.next();
String tableAlias = reportClientDocument.getDatabaseController().getDatabase().getTables().getTable(0).getAlias();
//Push the Java ResultSet into the report. This will then be the datasource of the report.
reportClientDocument.getDatabaseController().setDataSource(resultSet, tableAlias , "My1099_tbl1099M1");
reportSource = reportClientDocument.getReportSource();
精彩评论