ADO Database Delphi

Title: Creating a temporary database alias for current execution
Question: How to create programmatically database alias just for current execution?
Answer:
Article 903 (see also my comments there) shows how to use directory reference instead of database alias.
However you may prefer to use a temporary database alias just for the current execution (to be removed after the application terminates). The following example shows how to create such a temporary alias:
---------------
const
DatabaseAlias = 'MyTempAlias';
{...}
with Session do begin
ConfigMode := cmSession;
try
AddStandardAlias (DatabaseAlias,
ExtractFilePath(ParamStr(0)) + 'DB',
'PARADOX');
finally
ConfigMode := cmAll;
end; {try}
end; {with}
---------------
This piece of code creates temporary database alias named 'MyTempAlias' for Paradox database located in subdirectory \DB of the program executable directory. You should perform this code before activating your data controls - say, upon creating your datamodule or any other form with data controls. Note that you may have Database property of your data controls preset for the value 'MyTempAlias' at design time, so all you have to do to start working with your TTable etc. is to set its Active property to TRUE after executing the code above.