Setting database at runtime
Fast report version 3.09
Borland Delphi 7
In my application I load load reports at runtime and want to connect queries on the dialog page (in fr3 file) to an existing database connection at runtime. Since the queries in reports are cross-database compatible it's nice if I could develop reports separate from application, and then just load that custom fr3 in runtime.
A solution in v2.5 wat to set TfrxDBXQuery.Query.SQLConnection, but that does not work in v3.
If I set:
then PrepareReports (more precisely TfrxDBXQuery.BeforeStartReport) overrides that and sets TfrxDBXQuery.Query.SQLConnection to nil (because TfrxDBXQuery.Database is nil) and then error "SQLConnection property missing" is raised.
Even if I accept that another connection to the database is required for generating a report, and I set all TfrxDBXQuery properties at runtime, there is another problem. I can not leave TfrxDBXDatabase.DriverName blank (as I can in plain TSQLConnection), which means, that the dbxdrivers.ini is required at every client site. And TfrxDBXDatabase.Database is ReadOnly, so I can't set that at runtime either.
Any suggestions short of modifying frxDBXComponents.pas?
brgds
Andrej
Borland Delphi 7
In my application I load load reports at runtime and want to connect queries on the dialog page (in fr3 file) to an existing database connection at runtime. Since the queries in reports are cross-database compatible it's nice if I could develop reports separate from application, and then just load that custom fr3 in runtime.
A solution in v2.5 wat to set TfrxDBXQuery.Query.SQLConnection, but that does not work in v3.
If I set:
TfrxDBXQuery.Database:=nil;
TfrxDBXQuery.Query.SQLConnection:=MyExistingConnection;
then PrepareReports (more precisely TfrxDBXQuery.BeforeStartReport) overrides that and sets TfrxDBXQuery.Query.SQLConnection to nil (because TfrxDBXQuery.Database is nil) and then error "SQLConnection property missing" is raised.
Even if I accept that another connection to the database is required for generating a report, and I set all TfrxDBXQuery properties at runtime, there is another problem. I can not leave TfrxDBXDatabase.DriverName blank (as I can in plain TSQLConnection), which means, that the dbxdrivers.ini is required at every client site. And TfrxDBXDatabase.Database is ReadOnly, so I can't set that at runtime either.
Any suggestions short of modifying frxDBXComponents.pas?
brgds
Andrej
Comments