Crystal Reports for Eclipse Developer Guide

To logon to a subreport

The ReportClientDocument class allows you retrieve the database object for a subreport, which contains all tables from one or more databases. Using this object, you can set the location to a database that is different from the one originally specified.
To change the database of a subreport programmatically:
  • Specify the name of the subreport in the report whose database location you want to change.
  • Get the first table in the subreport through the SubreportController object.
  • Set the user name and password in the ConnectionInfo object of the first table in the subreport.
  • Set the table location for the subreport to a database that is different from the one originally specified when the subreport was created.
Example: 
void subreportLogon(ReportClientDocument rcd)
{        
	final String subReportName = "SubReport";
	ITable it = rcd.getSubreportController().getSubreportDatabase(subReportName).getTables().getTable(0);
	it.getConnectionInfo().setUserName("sa");
	it.getConnectionInfo().setPassword("sa");

	rcd.getSubreportController().setTableLocation(
		subReportName,
		(ITable)rcd.getSubreportController().getSubreportDatabase(subReportName).getTables().getTable(0), 
		it
	);
}



Business Objects, an SAP company
http://www.businessobjects.com/
Support services
http://www.businessobjects.com/services/support/
Product Documentation on the Web
http://support.businessobjects.com/documentation/