Instead of dragging a table from the Navigator, you can use data objects from the Component palette.

For SQL, ODBC, and other tables you’re accessing through a BDE alias,

  1. Drag a Database object from the Component palette to the form or report design surface. (One Query object is added along with it.)

Assign the BDE alias to the databaseName property.

Set its active property to true.

  1. For databases that require a login, you must either log in or set the Database object’s loginString property, so that the table will open without requiring a password or ID to be entered. (Your login name and password must be set up by your database administrator.)

  2. Select the Query object.

Type the SQL query statement you want in the Query object’s SQL property. Your SQL query can access any number of tables in the database. Some servers are case-sensitive for the table name; some may require quotation marks (Oracle, for example).

Assign the Database object to the Query object’s database property. This must be done before activating the query.

Set the Query object’s active property to true.

  1. Add additional Query objects, if needed for other tables, and set their properties as in step 2. (If you want to drag a table from another database, be sure to first select the desired alias from the Navigator’s Look In drop-down list, or in the case of BDE-standard tables without an alias, use the Navigator to locate the desired directory.)

For BDE-standard tables without a BDE alias, you do not need the Database object. Use only Query objects, and follow the instructions in steps 2 and 3.

To use tables accessed through a BDE alias, you must create new Database objects. Provided that you have created the BDE alias for your database, you need only activate the database object (and login if required) to have access to that database’s tables. You may also log transactions or buffer updates to each database to allow you to rollback, abandon, or post changes.

Note

A table’s fields do not appear on the Field palette until the Query object’s active property is set to true.