c++builder - Paradox DB: how to change database path programmatically -
I want to change my database paths programmatically. I have a folder with several tables, and my users can change from one database to another. For example: Active DB: D: \ APDDB \ DB can convert to 1D: \ APIID \ dB2 When I run the routines above the tables, then there is still the old path! I set the directory to the new directory, but my application still uses the old tables. What's wrong with this? Thanks for using TDatabase component with Set Set Ensure that Use the Clear the list by calling the clear method on the first parameter, then set the path by calling the add method. If you need multiuser access, then you have a NetDear on embedded TDatabase session component. It looks like in Delphi: You only need one connection in the database and do not need to add the
Table1-> database-> Directory = c;
TQuery . Do not use aliases.
TDatabase.DatabaseName You want to link
TTable and
TQuery components to the TDatabase component For the use of this name, their respective DatabaseName properties should be set to the same name as
TDatabase components.
TDatabase.DriverName to
Standard .
TDatabase.Connected is set to false.
TDatabase.Params to set the path of the database> Stringlist.
MyDatabase.Close; MyDatabase.Params.Clear; MyDatabase.Params.Add ('PATH =' + Pathtracker Database); // can be similar to NetFileDir database, but I recommend a separate folder. // All users must use the same folder only for multiuser access. MyDatabase.Session.NetFileDir: = PathOonnettextDear; MyDatabase.Open;
TSession component to use the database from the main UI thread only. TDatabase automatically creates a default session component in the
session property.
Comments
Post a Comment