Subject Re: User BDE Alias
From Ken Mayer <dbase@nospam.goldenstag.net>
Date Sun, 6 Aug 2023 12:57:20 -0700
Newsgroups dbase.getting-started

On 8/6/2023 8:54 AM, Mervyn Bick wrote:
> On 2023/08/06 16:06, Ketan G wrote:
>> Yes, the code below is what I tried just a few minutes after my
>> original post
>> and this works fine, plus another advantage is that the table does not
>> have to
>> be prefixed with the database name in colons.
>>
>> Thanks all for the help and suggestions.
>
> It works but bear in mind that if you run the command SET DATABASE TO
> WHATEVER from the Control Panel, or in a program executed from the IDE,
> the database displayed in the IDE Tables tab is changed to WHATEVER.
> This will cause a problem for the next program you want to execute from
> within the IDE if it expects its table to be in the same folder as the
> program.
>
> If a folder is selected in the combobox in the Tables tab the comboboxes
> in the other tabs also change to that folder and selecting a different
> folder in any of the tabs changes the display in the Tables tab.
>
> If a database is selected in the combobox in the Table tab the other
> comboboxes remain unchanged.  Changing to a different folder in any of
> the tabs does not change the setting in the Table tab.
>
> In the long run you are likely to find that prefixing the table name
> with the database name between colons gives less hassle than using SET
> DATABASE TO WHATEVER.
>
> If you use this approach in programs the OPEN DATABASE WHATEVER command
> should be in a try...catch...endtry construct otherwise there will be an
> error if you run the program a second time.

It's simple enough to add:

CLOSE DATABASE

There are many ways to handle things ... ;)

Ken

--
*Ken Mayer*
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
dBASE Tutorial: http://www.goldenstag.net/dbase/Tutorial/00_Preface.htm
dBASE Web Tutorial: http://www.goldenstag.net/dbase/WebTutorial/00_Menu.htm
dBASE DOS to Windows Tutorial:
http://www.goldenstag.net/dbase/DtoWTutorial/00_Menu.htm