Board index » delphi » How to get the path from an alias

How to get the path from an alias

Hi All,

I have an database in paradox and I use an alias for that.
Now I wonder how do I get the path for the alias in delphi.

 

Re:How to get the path from an alias


Quote
"H?an Sundelin" <hakan.sunde...@nce.fi> wrote in message <news:SMi_7.267$TP1.1000@news1.global-one.fi>...
> Hi All,

> I have an database in paradox and I use an alias for that.
> Now I wonder how do I get the path for the alias in delphi.

Read Database.Params strings

Re:How to get the path from an alias


"curious" <gil...@mail.ru> skrev i meddelandet
news:84b1a83c.0201072252.76d1d26a@posting.google.com...

Quote
> "H?an Sundelin" <hakan.sunde...@nce.fi> wrote in message

<news:SMi_7.267$TP1.1000@news1.global-one.fi>...

Quote
> > Hi All,

> > I have an database in paradox and I use an alias for that.
> > Now I wonder how do I get the path for the alias in delphi.

> Read Database.Params strings

Yes, but how?

Re:How to get the path from an alias


1. read a list of parameters:
Session.GetAliasParams(strAliasName, lstAliasParams);
where lstAliasParams is a TStrings (for example  yourCombobox.Items)

2. edDirectory.Text := lstAliasParams.Values['PATH'];

--
With best regards, Mike Shkolnik
E-Mail: mshkol...@scalabium.com
        mshkol...@yahoo.com
WEB: http://www.scalabium.com

H?kan Sundelin <hakan.sunde...@nce.fi> D???
???Y??:OAS_7.283$TP1....@news1.global-one.fi...

Quote

> "curious" <gil...@mail.ru> skrev i meddelandet
> news:84b1a83c.0201072252.76d1d26a@posting.google.com...
> > "H?an Sundelin" <hakan.sunde...@nce.fi> wrote in message
> <news:SMi_7.267$TP1.1000@news1.global-one.fi>...
> > > Hi All,

> > > I have an database in paradox and I use an alias for that.
> > > Now I wonder how do I get the path for the alias in delphi.

> > Read Database.Params strings

> Yes, but how?

Re:How to get the path from an alias


Thank You.

Re:How to get the path from an alias


function GetAliasPath(const AliasName: string): string;
var
  SAlias: DBINAME;
  Desc: DBDesc;
  Params: TStrings;
begin
  Result := '';
  StrPLCopy(SAlias, AliasName, SizeOf(SAlias) - 1);
  AnsiToOem(SAlias, SAlias);
  Check(DbiGetDatabaseDesc(SAlias, @Desc));
  if StrIComp(Desc.szDbType, szCFGDBSTANDARD) = 0 then begin
    OemToAnsi(Desc.szPhyName, Desc.szPhyName);
    Result := StrPas(Desc.szPhyName);
  end
  else begin
    Params := TStringList.Create;
    try
{$IFDEF WIN32}
      Session.Active := True;
{$ENDIF}
      Session.GetAliasParams(AliasName, Params);
      Result := Params.Values['SERVER NAME'];
    finally
      Params.Free;
    end;
  end;
end;

Quote
"H?kan Sundelin" <hakan.sunde...@nce.fi> wrote in message

news:A0__7.287$TP1.1092@news1.global-one.fi...
Quote
> Thank You.

Other Threads