procedure TForm1.ChangeAlias;var
AParams: TStringList;
Dir: string;
begin
if not Session.IsAlias('MyAlias') then
begin
ShowMessage('Alias MyAlias does not exist');
Exit;
end;
AParams := TStringList.Create;
try
// get the current PATH parameter
Session.GetAliasParams('MyAlias',AParams);
Dir := Copy(AParams.Strings[0],6,255);
// get the new PATH parameter
if InputQuery('MyAlias Alias Path','Path:' ,Dir) then begin
// Update the alias parameters
AParams.Clear;
AParams.Add('PATH=' + Dir);
Session.ModifyAlias('MyAlias',AParams);
Session.SaveConfigFile;
end;
finally
AParams.Free;
end;
end;
AParams: TStringList;
Dir: string;
begin
if not Session.IsAlias('MyAlias') then
begin
ShowMessage('Alias MyAlias does not exist');
Exit;
end;
AParams := TStringList.Create;
try
// get the current PATH parameter
Session.GetAliasParams('MyAlias',AParams);
Dir := Copy(AParams.Strings[0],6,255);
// get the new PATH parameter
if InputQuery('MyAlias Alias Path','Path:' ,Dir) then begin
// Update the alias parameters
AParams.Clear;
AParams.Add('PATH=' + Dir);
Session.ModifyAlias('MyAlias',AParams);
Session.SaveConfigFile;
end;
finally
AParams.Free;
end;
end;
var
MyList: TStringList;
begin
MyList := TStringList.Create;
try
with MyList do
begin
Add('PATH=你的数据库的路径');
Add('ENABLE BCD=FALSE');
end;
Session.AddAlias('你的数据库别名', 'PARADOX', MyList);
finally
MyList.Free;
end;
end; { SetAlias }