||Re: allowing user to change or add an alias
Ken Mayer <email@example.com>
||Sun, 18 Jun 2017 07:18:40 -0700
On 6/18/2017 6:27 AM, Charlie wrote:
> I tried this on my Windows 10 version 1607 64 bit computer at work and it does the same thing. (Dbase 10.3). Here is the exact code I am using. User is allowed to specify the path in a form which is connected to this program:
> parameter cpath
> close databases
> set procedure to :dUFLP:BDEAlias.cc
> oBDE = new BDEAlias()
> OBDE.DeleteAlias( "train" )
> oBDE.CreateAlias( "train", cpath )
> // where "PathToDatabase" would be the value from
> // the entryfield you have on your form ...
> release object oBDE
> oBDE = null
> close procedure :dUFLP:BDEAlias.cc
> msgbox ( "Database TRAIN path changed to " +cpath+"." )
> When you run the form it connects to this program. It does function. The first time you run it (if the alias already exists) dbase hangs up and never reaches the message box. But if you go into bde administrator the database is gone.
> If you run it again it hangs up the same way but if you go into the bde administrator the database is there and the path correctly defined.
> I don't think it is the code. There is just something goofy going on which is par for the course for me! :)
Something else to look at is to use what are called User BDE Aliases,
which don't write to the IDAPI.CFG file at all. They act exactly like
standard aliases, but ...
These are often written into the .INI file for the application. I have
one application that uses these for two different aliases:
These can be modified on installation of your application with Inno
Setup, and they can be modified in code using (again from the dUFLP)
You can also just put them into your application's startup code, but I
kind of like having them in the .ini file.
Ken's dBASE Page: http://www.goldenstag.net/dbase
The dUFLP: http://www.goldenstag.net/dbase/index.htm#duflp
dBASE Books: http://www.goldenstag.net/dbase/Books/dBASEBooks.htm