open database with initfile
- by ml
how to open a database local or remote with IniFile.
something like the below.
[code]vBanco : String;
IniFileName : TIniFile;
begin
if FileExists (remote+'db\ado.mdb')
IniFileName := TIniFile.Create(ExtractFilePath(ParamStr(0))+FileName);
Try
vBanco := Trim(IniFileName.ReadString('acesso','BancoRemto',''));
Dirlocal := Trim(IniFileName.ReadString('acesso','PastasRemto',''));
frmPrincipal.Edit1.text := Dirlocal;
Dirtrabalho := (ExtractFilePath(Application.ExeName));
Conection.ConnectionString := vBanco;
else ................................................
begin
Try
vBanco := Trim(IniFileName.ReadString('acesso','banco',''));
Dirlocal := Trim(IniFileName.ReadString('acesso','PastasLocais',''));
frmPrincipal.Edit1.text := Dirlocal;
Dirtrabalho := (ExtractFilePath(Application.ExeName));
Finally
end;
end;
end;
IniFileName.Free;