Mega Code Archive

 
Categories / Delphi / ADO Database
 

Bde alias info

The following function usees the GetAliasParams method of TSession to get the directory mapping for an alias: uses DbiProcs, DBiTypes; function GetDataBaseDir(const Alias : string): String; (* Will return the directory of the database given the alias (without trailing backslash) *) var sp : PChar; Res : pDBDesc; begin try New(Res); sp := StrAlloc(length(Alias)+1); StrPCopy(sp,Alias); if DbiGetDatabaseDesc(sp,Res) = 0 then Result := StrPas(Res^.szPhyName) else Result := ''; finally StrDispose(sp); Dispose(Res); end; end;