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 clean (); Sprintf (c, "path =% s", dir.c_str ()); List-> Couples (c); Session-> ModifyAlias ​​(dbalias, list); Delete list; Table 1- & gt; Database name = dbias; }

When I run the routines above the tables, then there is still the old path!

  Table1-> database-> Directory = c;   

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

TTB or TQuery . Do not use aliases.

Set 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.

Set TDatabase.DriverName to Standard .

Ensure that TDatabase.Connected is set to false.

Use the TDatabase.Params to set the path of the database> Stringlist.

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:

  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;   

You only need one connection in the database and do not need to add the TSession component to use the database from the main UI thread only. TDatabase automatically creates a default session component in the session property.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -