下面是程序出错的地方,都在SESSION 处出错的,请看一下
程序1:
var
reg:tregistry;
Key,s: String;
ph: TStringList;
strAsliasPath:string;
begin
s:=ExtractFilePath(ParamStr(0))+'bde';
Reg:=TRegistry.Create;
Reg.RootKey:=HKEY_LOCAL_MACHINE;
key:='/software/borland/database engine';
if reg.openkey(key,true) then
reg.writestring('dllpath',s);
Key:='/Software/Borland/BLW32';
if Reg.OpenKey(Key, True) then
Reg.WriteString('BLAPIPATH',s);
Key:='/Software/Borland/BLW32';
if Reg.OpenKey(Key, True) then
begin
Reg.WriteString('LOCALE_LIB0','fareasst.bll');
reg.WriteString('LOCALE_LIB1','usa.bll');
end;
Reg.Free;
strAsliasPath:=ExtractFiledir(ParamStr(0))+'/data';
ph := TStringList.Create;
session.PrivateDir:=s;
Session.GetAliasNames(ph);
if (ph.IndexOf('ebdata') <> -1) then
session.DeleteAlias('ebdata');
Session.AddStandardAlias('ebdata',strAsliasPath , 'Paradox');
Session.SaveConfigFile;
ph.Free;
程序2:
var
reg:tregistry;
Key,s: String;
ph: TStringList;
strAsliasPath:string;
begin
Reg:=TRegistry.Create;
Reg.RootKey:=HKEY_LOCAL_MACHINE;
s:=ExtractFilePath(ParamStr(0))+'bde';
key:='/software/borland/database engine';
if reg.openkey(key,true) then
reg.writestring('dllpath',s);
Key:='/Software/Borland/BLW32';
if Reg.OpenKey(Key, True) then
Reg.WriteString('BLAPIPATH',s);
Key:='/Software/Borland/BLW32';
if Reg.OpenKey(Key, True) then
begin
Reg.WriteString('LOCALE_LIB0','fareasst.bll');
reg.WriteString('LOCALE_LIB1','usa.bll');
end;
Reg.Free;
strAsliasPath:=ExtractFiledir(ParamStr(0))+'/data';
ph := TStringList.Create;
session.PrivateDir:=s;
Session.GetAliasNames(ph);
if (ph.IndexOf('ebdatacity') <> -1) then
session.DeleteAlias('ebdatacity');
Session.AddStandardAlias('ebdatacity',strAsliasPath , 'Paradox');
Session.SaveConfigFile;
ph.Free;