Subject |
Re: User BDE Alias |
From |
Ken Mayer <dbase@nospam.goldenstag.net> |
Date |
Sun, 6 Aug 2023 05:49:32 -0700 |
Newsgroups |
dbase.getting-started |
On 8/6/2023 3:43 AM, Mervyn Bick wrote:
> 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.
The other solution to this is:
open database somealias
set database to somealias
then:
select * from abc
should work. By using the "set database" command you are pointing to
that specific database, and that's what dBASE will use other than the
current folder. Just opening it isn't "enough".
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
|
|