For simple Paradox access, I recommend you use theTDatabase
component together with TTable
or TQuery
. Don't use aliases.
Set TDatabase.DatabaseName
to anything you want. You use this name to link TTable
and TQuery
components to the TDatabase component. Their corresponding DatabaseName properties should be set to the same name as the TDatabase
component.
Set TDatabase.DriverName
to STANDARD
.
Make sure TDatabase.Connected
is set to false.
To set the path to the database use the TDatabase.Params
stringlist.
First clear the list by calling the Clear method on Params, then set the path by calling the Add method.
If you need multiuser access then you also need to set a netdir on the embedded TDatabase session component.
This is what it would look like in Delphi:
MyDatabase.Close;
MyDatabase.Params.Clear;
MyDatabase.Params.Add('PATH=' + PathToYourDatabase);
// NetFileDir can be the same as the database, but I recommend a different folder.
// Only needed for multiuser access. All users must use the same folder.
MyDatabase.Session.NetFileDir := PathToYourNetFileDir;
MyDatabase.Open;
You don't need to add a TSession
component if you only need one connection to the database and only access the database from the main UI thread. TDatabase automatically creates a default session component in the Session
property.