Author: Tomas Rutkauskas
Add database aliases to BDE at run time
Answer:
This function that will let you add database aliases to BDE (Borland Database
engine) during run time:
1 uses2 DBIProcs, DBITypes;
3 4 procedure AddBDEAlias(sAliasName, sAliasPath, sDBDriver: string);
5 var6 h: hDBISes;
7 begin8 DBIInit(nil);
9 DBIStartSession('dummy', h, '');
10 DBIAddAlias(nil, PChar(sAliasName), PChar(sDBDriver),
11 PChar('PATH:' + sAliasPath), True);
12 DBICloseSession(h);
13 DBIExit;
14 end;
15 16 { Sample call to create an alias called WORK_DATA that }17 { points to the C:\WORK\DATA directory and uses the }18 { DBASE driver as the default database driver: }19 20 AddBDEAlias('WORK_DATA', 'C:\WORK\DATA', 'DBASE');