Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

change table.databasename of template sql at runtime

edited March 2005 in General
I have a lot of template reports (rtm files) which contains sql queries.
I need to change the databasename of the Tables of the Query, BUT not
the same for every Tables.

For example, on this query:
"select * from A, B"

I need to use a databasename for "A" and ANOTHER Databasename for "B".

I can change the DataBaseName of the whole query with the following code:

lDataModule := daGetDataModule(aReport);
if (lDataModule <> nil) then
begin
for liIndex:=0 to lDataModule.DataViewCount-1 do
begin
lDataView := TdaQueryDataView(lDataModule.DataViews[liIndex]);
if (lDataView <> nil) and (lDataView is TdaQueryDataView) then
TdaQueryDataView(lDataView).SQL.DatabaseName := path;
end;
{...}
end;

Is it possible to change the databasename for each Table of the query?
If not... I have thought of changing "A" for "\path1\A.db" and "B" for
"\path2\B" directly on the Sql.Text. Is it possible?

Comments

This discussion has been closed.