Board index » delphi » gettting BDE alias path

gettting BDE alias path

Is there a function call to get the directory path of a BDE alias?  In other
words, I KNOW what the alias of the table to be used is, but I need to get
the directory path.  I want to get this info. without starting a session or
opening a table.

If you could give me a reference, I would appreciate it.

-Ed

 

Re:gettting BDE alias path


Quote
Ed Blackburne <eco_...@shsu.edu> wrote in message

news:7uik1m$sbs$1@unxnews.shsu.edu...

Quote
> Is there a function call to get the directory path of a BDE alias?  In
other
> words, I KNOW what the alias of the table to be used is, but I need to get
> the directory path.  I want to get this info. without starting a session
or
> opening a table.

I'm not sure why you say "without starting a session". A default session is
automatically started at runtime if your app uses any database controls -
that is, if any of your forms uses DB.pas. The initialization of DB.pas does
this...
  Sessions := TSessionList.Create;
  Session := TSession.Create(nil);
  Session.SessionName := 'Default';

So the simplest way to convert an alias to a path is...

uses DB;

function AliasLocation(const Alias: string): string;
var
  AliasParams: TStringList;
begin
  AliasParams := TStringList.Create;
  try
    Session.GetAliasParams(Alias, AliasParams);
    Result := AliasParams.Values['Path'];
  finally
    AliasParams.Free;
  end;
end;

--
Stephen Brown

Other Threads