Re:MODIFYALIAS HELP!!!!
Harry Carelsen wrote
Quote
> I followed your advice , but the same problem occurs: I loose my
> connections when my 'data aware forms' are NonModal.
Sorry, i've problem with my Internet connections....
I think that solution to your problem is to store tables Active for
the Alias you want to change and to restore (open) after the change
of alias params.
Before you change the 'scenario' you have to scan the Datasets
property of the TDatabase component and store (in a
TList/TstringList) which datasets are open.
After the change scan the TList and reopen the datasets ... like in
the following code:
procedure TForm1.ChangeCompanyAlias( cNewPath:string);
var
DataSetList : TList;
nCtr : integer;
begin
DatasetList := TList.Create;
try
with DatabaseCompany do begin
for nCtr := 0 to DatasetCount-1 do begin
if Datasets[nCtr].active then
Dataset.Add( Datasets[nCtr]);
end;
end;
DatabaseCompany.Close;
DatabaseCompany.Params.Clear;
DatabaseCompany.Params.Add( cNewPath);
with DatasetList do begin
for nCtr := 0 to Count-1 do begin
TDBDataSet( Objects[nCtr]).Open;;
end;
end;
finally
DatasetList.Free;
end;
end;
Ciao and have good work time
Paolo Boscarato