Creating a BDE Alias

The instructions given here are for the 32-bit version of Visual dBASE, but very similar instructions can be used for the 16-bit version (which is what Visual dBASE 5.x uses).

A BDE Alias is used in two ways. If you are working with SQL Server databases (Interbase, Oracle, etc.), you use the BDE Alias as a pointer to that database. If you are using local tables, you use the BDE Alias to treat those local tables as if they were a SQL Server database.

Why would you want to use a BDE alias? The following are a few reasons, and there are probably others ...

Setting Up An Alias

The first step is to actually create a BDE alias. To do this, you must bring up the BDE Administrator (there should be an icon in the folder for Visual dBASE -- double click on it).

In the BDE Administrator, click on the "Databases" tab. The treeview may appear as closed, so click on the "+". Depending on your setup, you may or may not see a bunch of aliases already set in the Administrator. When you install Visual dBASE several aliases are created for you, for example "MUGS" and "VDBSAMPLE". Click on "MUGS" if it is there. On the right side of the screen you should see four entries:

     Type: Standard
     DEFAULT DRIVER: DBASE
     ENABLE BCD: false
     PATH: C:\Program Files\Borland\Visual dBASE\Samples\Mugs\Tables

This is the important information for your alias. The "Type" should be "Standard" for local tables, and you may see (depending on your installation) other types if you check other aliases - these refer to the table's server and/or the driver. If you are using dBASE tables, make sure the default driver is "DBASE". You probably don't need BCD, don't worry about it (check online help if you are curious). The "Path" is the actual location of the tables.

NOTE: If the "Type" is something other than "Standard", there are a bunch of other options that may appear -- you will need to examine those and have some idea what they mean for that specific server or driver.

To create a new alias, on the left half of the BDE Administrator screen, right click and select "New ...". Select "Standard" unless you need to select, say, "Interbase" (note, if you are using local InterBase and have the Client/Server edition of Visual dBASE, use the driver named "INTRBASE"), and click "OK". Set the Default Driver to "DBASE" (unless you are using PARADOX tables), and then click on the "..." button for the path. This will bring up a standard path dialog ... select the path to your tables. You probably want to give this a different name -- on the left side of the screen, click on "STANDARD1" and type a new name there (like "MyAlias").

At this point, you have the alias created in the BDE Administrator. However, you will want to "Apply" it (CTRL+A) and then exit the administrator. This saves the information to your .CFG file for the BDE.

If Visual dBASE was up at the time you did this, you should exit it and restart it ... otherwise the new alias will not appear.

Using a BDE Alias

To use a BDE Alias, you start Visual dBASE, and in the Navigator select the "Tables" tab. In the "Look In" combobox, select your new alias. (If it is selected, the image will show a green "spot" in the database image.)

From this point on, while developing, you will be automatically using this alias.

NOTE: If you work on multiple projects life could get a bit confusing because each database you open will stay open. If you quit dBASE, and come back to it later, it will re-open your databases. Before you quit, you may want to issue a:

           CLOSE DATABASES

command (in the Command Window). This will shut down all BDE Aliases, so that the next time you load dBASE they will not automatically be opened.

A couple of suggestions:

"select * from :MyAlias:SomeTable"

or

use :MyAlias:SomeTable    

Note the colons around the alias name. That is very important. (All of this assumes that the database is open. The simple method of opening it is to go to the navigator, click on the "Tables" tab, in the "Look In" combobox select the database alias... you can also type in the command window:

            OPEN DATABASE aliasName
            SET DATABASE TO aliasName

which will accomplish the same task ...)