不知道,有没有人去过水晶公司的论坛。看过上面一篇名叫Crystal hate JAVA Programmer的文章吗? 虽然,那个老外最后还是解决的问题,但是还有很多的问题存在。不知道各位有用过RAS JAVA SDK成功写过动态建立报表(也就是程序控制产生的一次性报表),并且调用动态数据源的程序。 有人知道,这个API怎么用吗?com.crystaldecisions.sdk.occa.report.application Class DatabaseControlleraddDataSource public void addDataSource(java.sql.ResultSet data) throws ReportSDKExceptionAdds a java.sql.ResultSet or RAS data set as a data source for the report. To set a runtime data source into a report, the report must be created with a data source using Crystal Reports, or added to the report using this method. Set the data source in the report using the setDataSource method. Parameters: data - The java.sql.ResultSet object to be added. Throws: ReportSDKException - 加进去的数据,怎么才能调出来?----------------------------------------- 又有谁成功试过下面这个crystalReport的JAVADOC里面带的例子。 Adding tables using a connection string To add tables to a report, you must use a controller (in this case the DatabaseController) because they are the only objects capable of modifying the Report Application Server object model. IDatabase is used to retrieve the tables from another source report, but cannot be used to add them.In order to add tables to a report, you will need to:Add a data source Add a table using a connection string Link the tables Adding a data source In order to add tables to a report, you first need to create a JDBC connection, select a ResultSet, and add it as a data source.To add a data source Create a JDBC connection to the database you want to use. String url = "jdbc:odbc:Xtreme Sample Database"; java.sql.Connection jdbcConnection = DriverManager.getConnection(url, "guest", "password"); java.sql.Statement statement = jdbcConnection.createStatement();Query the database for the ResultSet you want. String query = "SELECT * FROM `Product` `Product`"; java.sql.ResultSet resultSet = statement.executeQuery( query );Add the ResultSet as a data source to the DatabaseController. document.getDatabaseController().addDataSource( resultSet );Adding tables using a connection string Data can also be retrieved by using a connection string. This allows you to retrieve data using a SQL query or a dictionary file in place of adding tables from a source report. To add a table using a connection string Create a new table to hold the data retrieved from the connection. String tableName = "Product_Type"; ITable newTable = new Table(); newTable.setName(tableName); newTable.setAlias(tableName); ConnectionInfo connectionInfo = newTable.getConnectionInfo();Specify the type of connection to be made. connectionInfo.setKind( ConnectionInfoKind.CRQE );Specify the database DLL. This can be either crdb_query.dll or crdb_dictionary.dll depending on the desired connection. PropertyBag dbDll = new PropertyBag(); dbDll.putStringValue(PropertyBagHelper.CONNINFO_DATABASE_DLL, "crdb_query.dll"); connectionInfo.setAttributes(dbDll);Specify the database logon properties. For additional properties, see the PropertyBagHelper class. PropertyBag logonProperties = new PropertyBag(); logonProperties.putStringValue( "Crystal SQL Query", "/queryPath"); connectionInfo.getAttributes().put(PropertyBagHelper.CONNINFO_CRQE_LOGONPROPERTIES, logonProperties);Supply logon information if it is required. connectionInfo.setUserName(userName); connectionInfo.setPassword(password);Add the table to the document. TableLinks dummyLink = new TableLinks(); document.getDatabaseController().addTable(newTable, dummyLink);Linking the tables The tables then need to be linked. To link the tables Link the tables using the following line. document.getDatabaseController().doSmartLinking();---------------------------------------- 没有文档,例子又跑不起来。还有bug!!!!这个我就不说了!自己去它的网站上的论坛看看吧!!!! 我听说这个公司被微软收购了!!!!!这就是原因吧!!!!!
非常感谢
建议大家不要用crystalreport的Java功能。没有文档,没有支持,没有充分的例子。有的只是大bug和无奈。
[email protected]
[email protected]
谢谢
非常感谢!!!
十分感谢!!!!!!!!!!!!!!!
愿闻其详:)
[email protected]
不知能否收到您的回音!
[email protected]
谢谢!
需要的人请发邮件给我:[email protected]
虽然,那个老外最后还是解决的问题,但是还有很多的问题存在。不知道各位有用过RAS JAVA SDK成功写过动态建立报表(也就是程序控制产生的一次性报表),并且调用动态数据源的程序。
有人知道,这个API怎么用吗?com.crystaldecisions.sdk.occa.report.application
Class DatabaseControlleraddDataSource
public void addDataSource(java.sql.ResultSet data)
throws ReportSDKExceptionAdds a java.sql.ResultSet or RAS data set as a data source for the report. To set a runtime data source into a report, the report must be created with a data source using Crystal Reports, or added to the report using this method. Set the data source in the report using the setDataSource method. Parameters:
data - The java.sql.ResultSet object to be added.
Throws:
ReportSDKException - 加进去的数据,怎么才能调出来?-----------------------------------------
又有谁成功试过下面这个crystalReport的JAVADOC里面带的例子。
Adding tables using a connection string
To add tables to a report, you must use a controller (in this case the DatabaseController) because they are the only objects capable of modifying the Report Application Server object model. IDatabase is used to retrieve the tables from another source report, but cannot be used to add them.In order to add tables to a report, you will need to:Add a data source
Add a table using a connection string
Link the tables
Adding a data source
In order to add tables to a report, you first need to create a JDBC connection, select a ResultSet, and add it as a data source.To add a data source
Create a JDBC connection to the database you want to use.
String url = "jdbc:odbc:Xtreme Sample Database";
java.sql.Connection jdbcConnection = DriverManager.getConnection(url, "guest", "password");
java.sql.Statement statement = jdbcConnection.createStatement();Query the database for the ResultSet you want.
String query = "SELECT * FROM `Product` `Product`";
java.sql.ResultSet resultSet = statement.executeQuery( query );Add the ResultSet as a data source to the DatabaseController.
document.getDatabaseController().addDataSource( resultSet );Adding tables using a connection string
Data can also be retrieved by using a connection string. This allows you to retrieve data using a SQL query or a dictionary file in place of adding tables from a source report.
To add a table using a connection string
Create a new table to hold the data retrieved from the connection.
String tableName = "Product_Type";
ITable newTable = new Table();
newTable.setName(tableName);
newTable.setAlias(tableName);
ConnectionInfo connectionInfo = newTable.getConnectionInfo();Specify the type of connection to be made.
connectionInfo.setKind( ConnectionInfoKind.CRQE );Specify the database DLL.
This can be either crdb_query.dll or crdb_dictionary.dll depending on the desired connection.
PropertyBag dbDll = new PropertyBag();
dbDll.putStringValue(PropertyBagHelper.CONNINFO_DATABASE_DLL, "crdb_query.dll");
connectionInfo.setAttributes(dbDll);Specify the database logon properties.
For additional properties, see the PropertyBagHelper class.
PropertyBag logonProperties = new PropertyBag();
logonProperties.putStringValue( "Crystal SQL Query", "/queryPath");
connectionInfo.getAttributes().put(PropertyBagHelper.CONNINFO_CRQE_LOGONPROPERTIES, logonProperties);Supply logon information if it is required.
connectionInfo.setUserName(userName);
connectionInfo.setPassword(password);Add the table to the document.
TableLinks dummyLink = new TableLinks();
document.getDatabaseController().addTable(newTable, dummyLink);Linking the tables
The tables then need to be linked.
To link the tables
Link the tables using the following line.
document.getDatabaseController().doSmartLinking();----------------------------------------
没有文档,例子又跑不起来。还有bug!!!!这个我就不说了!自己去它的网站上的论坛看看吧!!!!
我听说这个公司被微软收购了!!!!!这就是原因吧!!!!!
我也决定要一个
我也要一份,OK?