- 论坛徽章:
- 0
|
好
我现在用的是eclipse3.2自带的crystal来做水晶报表, 现在简单数据报表都已完成.
想请教下在:
[color=Red]1.[/color] 我可否设置每页显示记录的条数, 怎么设置
[color=Red]2.[/color] 不知哪位是否有连接oracle的方法, 在下载的例子中,
private static void switch_tables(DatabaseController databaseController) throws ReportSDKException {
//Declare the new connection properties that report's datasource will be switched to.
//NOTE: These are specific to using JDBC against a particular MS SQL Server database. Be sure to use the
//DisplayConnectionInfo sample to determine what your own connection properties need to be set to.
final String TABLE_NAME_QUALIFIER = "xtreme.dbo.";
final String DBUSERNAME = "devtech";
final String DBPASSWORD = "devtech";
final String SERVERNAME = "vancsdb02.crystald.net";
final String CONNECTION_STRING = "Use JDBC=b(true);Connection URL=s(jdbc:microsoft:sqlserver://vancsdb02.crystald.net:1433);" +
"Database Class Name=s(com.microsoft.jdbc.sqlserver.SQLServerDriver);Server=s(vancsdb02.crystald.net);" +
"User ID=s(vantech);Password=;Database=s(Xtreme1);Trusted_Connection=b(false);" +
"JDBC Connection String=s(!com.microsoft.jdbc.sqlserver.SQLServerDriver!jdbc:microsoft:sqlserver://vancsdb02.crystald.net:1433;" +
"DatabaseName={database};user={userid};password={password}!)";
final String DATABASE_NAME = "Xtreme";
final String URI = "!com.microsoft.jdbc.sqlserver.SQLServerDriver!jdbc:microsoft:sqlserver://vancsdb02.crystald.net:1433;DatabaseName={database};user={userid};password={password}!";
final String DATABASE_DLL = "crdb_jdbc.dll";
//Obtain collection of tables from this database controller.
Tables tables = databaseController.getDatabase().getTables();
//Set the datasource for all main report tables.
for (int i = 0; i < tables.size(); i++) {
ITable table = tables.getTable(i);
//Keep existing name and alias.
table.setName(table.getName());
table.setAlias(table.getAlias());
//Change properties that are different from the original datasource.
table.setQualifiedName(TABLE_NAME_QUALIFIER + table.getName());
//Change connection information properties.
IConnectionInfo connectionInfo = table.getConnectionInfo();
//Set new table connection property attributes.
PropertyBag propertyBag = new PropertyBag();
//Overwrite any existing properties with updated values.
propertyBag.put("Trusted_Connection", "false");
propertyBag.put("Server Name", SERVERNAME); //Optional property.
propertyBag.put("Connection String", CONNECTION_STRING);
propertyBag.put("Database Name", DATABASE_NAME);
propertyBag.put("Server Type", "JDBC (JNDI)");
propertyBag.put("URI", URI);
propertyBag.put("Use JDBC", "true");
propertyBag.put("Database DLL", DATABASE_DLL);
connectionInfo.setAttributes(propertyBag);
//Set database username and password.
//NOTE: Even if these the username and password properties don't change when switching databases, the
//database password is *not* saved in the report and must be set at runtime if the database is secured.
connectionInfo.setUserName(DBUSERNAME);
connectionInfo.setPassword(DBPASSWORD);
connectionInfo.setKind(ConnectionInfoKind.SQL);
table.setConnectionInfo(connectionInfo);
//Update old table in the report with the new table.
databaseController.setTableLocation(table, tables.getTable(i));
}
}
我修改后, 老是报错.
我现在的查数据部分都是在rpt里面实现的. |
|