change table.databasename of template sql at runtime
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?
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?
This discussion has been closed.
Comments
Unfortunately the dataviews were not designed to access multiple databases
at once. You will need to create multiple dataviews in order to access more
than one database at once.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com