Subject Re: User BDE Alias
From Mervyn Bick <invalid@invalid.invalid>
Date Sun, 6 Aug 2023 12:43:37 +0200
Newsgroups dbase.getting-started

On 2023/08/05 17:28, Ketan G wrote:
> Hi Folks,
>
> I am trying to access a local table using a User BDE Alias. These settings were put in the Plus.ini file and the alias shows up correctly when dBase is started.
>
> [UserBDEAliases]
> 5=SomeAlias (there are 4 already present)
> ...
> [SomeAlias]
> Driver=DBASE
> Options=PATH:c:\somefolder
>
> The "somefolder" above contains a single table eg. "abc.dbf", and these commands within dBase result in the following:
>
> open database SomeAlias (no error)
>
> select * from abc
>
> (I get a message saying "abc.dbf" is not found in the folder "c:\tempfolder".
>  From the [Directories] section in the Plus.ini file, I realized that this is the folder marked "Current=n", but I am confused. If the alias contains the path, why is the table not being found in the right place and why is the "current" folder being searched?
>
> Maybe I am missing something simple, any help would be nice.

The problem is caused by not using the correct syntax.

SELECT * FROM WHATEVER is actually a localSQL command statement and,
like USE WHATEVER (which is DML), only works in the IDE on .dbf files in
the folder pointed to by Current=n.  This is the folder shown in the
"Look In" combobox on the Tables tab in the IDE.  Both SELECT and USE
open a table in a DML workarea and are interchangeable in a DML program.

If you want to access abc.dbf in the IDE Command Panel without changing
to the database in the Tables tab you need to both open the database as
you have done AND specify the database in the SELECT (or USE) statement.

open database somealias  //This is not case sensitive
select * from :somealias:abc  //Again, not case sensitive
or
use :somealias:abc

In a program, dBASE always opens a default database for the folder
containing the program.   If the table is in the same folder as the
program there is no need to OPEN DATABASE when using DML or to include a
database object when using OODML.  Conversely, if the table and program
are not in the same folder you need to OPEN DATABASE in DML or use a
database object in OODML.

Mervyn.