Board index » delphi » Change path of BDE-alias at run-time

Change path of BDE-alias at run-time

Hello everybody

I have a little problem. Is it possible to change the path of an
existing BDE-alias from a Delphi application. I know that is is
API-calls to add a new alias and delete an existing alias. Is it an
API-call to configure an existing BDE-alias.

Hope someone can help me with this.

J?rn Walle
Norway

 

Re:Change path of BDE-alias at run-time


J?rn Walle <jorn.wa...@bodo.teamco.telenor.no> wrote in article
<336F0206.3FDFC...@bodo.teamco.telenor.no>...

Quote
> Hello everybody

> I have a little problem. Is it possible to change the path of an
> existing BDE-alias from a Delphi application. I know that is is
> API-calls to add a new alias and delete an existing alias. Is it an
> API-call to configure an existing BDE-alias.

> Hope someone can help me with this.

> J?rn Walle
> Norway

Are you using Delphi 2.0 +

If so, you can use modifyalias to change the alias on the fly.  However,
before your running app knows about the change, you have to close down the
tdatabase object that represents that alias.

Each application has a tsession variable which contains an array of
tdatabases, one tdatabase for each alias your using.  You can use the
finddatabase method if you have more than one alias. Once you have found
your database in the session.databases array, simply close the tdatabase
object. All datasets for that alias will then close.  The database object
will 'open' the next time any dataset opens.

For example...

session.databases[0].close;

will close the first tdatabase in the databases array.

Other Threads