另外還有一種判斷的方法,以下為一個實例:
Procedure TBasDM.LoginServer;
var tempIni: TIniFile;
tmpServerFrm: TServerFrm;
i:Integer;
tmpList:TStringList;
IsAliasName:Boolean;
begin
IsAliasName:=false;
tmpList:= TStringList.Create;
try
Session.GetAliasNames(tmpList);
for I := 0 to tmpList.Count - 1 do
if tmpList[i]='CostingDB' then
IsAliasName:=true;
if not IsAliasName then
Session.AddAlias('CostingDB','MSSQL',CostDB.Params);
finally
tmpList.Free;
end;