Board index » delphi » Alias and Path

Alias and Path

I want to delete an Alias and the Data in the connected path (by
program). I know the AliasName, but if  I want to delete the data, I
need the path. I think one way to do this is by using
session.getaliasparams, search for the string 'path = ...' and work with
this string, but is this the only one, or is there still another?

Thanks, Jana

 

Re:Alias and Path


Quote
>I want to delete an Alias and the Data in the connected path (by
>program). I know the AliasName, but if  I want to delete the data, I
>need the path. I think one way to do this is by using
>session.getaliasparams, search for the string 'path = ...' and work with
>this string, but is this the only one, or is there still another?

function GetAliasPath( a : string) : string;
var
  t : TStringList;
begin
  t := TStringList.Create;
  try
    Try
       Session.GetAliasParams(a,t);
    Except on E:EdbEngineError Do Begin
            MessageDlg('Alias '+a+' does not exist', mtError, [mbOk], 0);
            Abort
        end;
    end;
    Result := Copy(t[0],6,Length(t[0]));
  finally
    t.free;
  end;
end;

--
Brian Bushay (TeamB)
Bbus...@DataGuidance.com

Re:Alias and Path


Thank you for your answer -
 this function works well with an paradox-alias, but I also use access-
databases (via odbc) and for such an alias, the functions result is not the
path. I have also tried with session.getaliasparams :
  Parameterliste := TStringList.Create;
  Session.GetAliasParams(AlName,Parameterliste);
  path := Parameterliste.Values['PATH'];
  Parameterliste.free;
but if AlName is an alias for an access database, the path is '' (also in
BDE-configuration there is no pathname), although I give a path to the
addalias-method, when I create the Alias. I think, the path is given from the
32-bit-odbc-configuration when I work with this database, but I dont know,
how to get this one.

Jana

Brian Bushay TeamB schrieb:

Quote
> function GetAliasPath( a : string) : string;
> var
>   t : TStringList;
> begin
>   t := TStringList.Create;
>   try
>     Try
>        Session.GetAliasParams(a,t);
>     Except on E:EdbEngineError Do Begin
>             MessageDlg('Alias '+a+' does not exist', mtError, [mbOk], 0);
>             Abort
>         end;
>     end;
>     Result := Copy(t[0],6,Length(t[0]));
>   finally
>     t.free;
>   end;
> end;

> --
> Brian Bushay (TeamB)
> Bbus...@DataGuidance.com

Re:Alias and Path


Quote
> this function works well with an paradox-alias, but I also use access-
>databases (via odbc) and for such an alias, the functions result is not the
>path. I have also tried with session.getaliasparams :

I do not know how you would deal with this if you are using ODBC.
Different Alias types have different paramaters and PATH isn't one for all of
them.  With ODBC drivers BDE doesn't have to know where the database is becuase
ODBC handles it.    If you go to the native Access driver you can use the
Database name paramater and parse out the .mdb name

--
Brian Bushay (TeamB)
Bbus...@DataGuidance.com

Other Threads