Data objects provide live connections and session control to tables and databases. A form or report that accesses a table must have at least one Query object on it, returning a rowset from the table. A StoredProc object that returns a rowset (as a query would) can be used in place of the Query object.

Note

Once you have set up a group of data objects to return rowsets, you can save that group in a data module for easy reuse in other forms and reports or other applications.

This table describes the data objects available from the Data Access page of the Component palette.

Object

Lets you...

Explanation

Query
image\QUERYBUTTON.gif

Run an SQL query on any table, including local .DBF and .DB tables. Query objects enable components to display data from tables on forms and reports.

You set a Query object’s SQL property to the SQL statement that selects a rowset. In addition to linking a table to a form or report, this populates the Field palette.

You must use a Query object containing an appropriate SQL statement to connect to a table or database (unless you are using a StoredProc object to return a rowset from an SQL database).

StoredProc
image\STORPROCBUTTON.gif

Run a stored procedure on an SQL server. This capability is available only when accessing tables on a server that supports stored procedures.

Place the StoredProc control on a form or report and link the control to a stored procedure by setting its procedureName property. If the stored procedure returns a rowset, it may be used in place of a Query object.

Database
image\DATABASEBUTTON.gif

Set up a persistent connection to a database, especially a remote client/server database requiring a user login and password.

Gives dBASE Plus forms and reports access to SQL databases (or another group of tables identified by an alias). To add connections to SQL databases or other multiple tables via a BDE alias, add a Database object to your form.

You must have first created a BDE alias for the database by using the BDE Administrator.

Session
image\SESSIONBUTTON.gif

Session objects enable basic record-locking, so that multiple users do not modify the same record at the same time. Session objects also help to maintain security logins for local .DBF or .DB tables.

Use only if you are creating a multithreaded database application. When you open a form, a default session is created, linking the form to the BDE and connected tables. If you need separate threads for each user (to ensure record-locking), add a Session object to your form. A unique session number is assigned to track each user’s connection to the table.

DataModRef
image\DATAMODREFBUTTON.gif

Use a preset data access setup stored in a data module.

Use to give a form or report access to a set of data access components you’ve programmed and stored in a data module.