DBOpen

Use this procedure/function to open the specified database table in the mode you request.

The DBOpen procedure supports having multiple:

Syntax

DBOpen (Table, Handler, DFDFile, Mode, Truncate)

Parameter

Description

Table

Enter the name of the table you want to open.

Handler

Enter the name of the database handler to associate with the table.

If you omit Handler, DBOPEN looks in the DBTable:TableName control group for the DBHandler option. If this option is not present, DBOPEN defaults to the ODBC or JDBC handler.

DFDFile

Enter the name of the format file to associate with the table.

If omitted, the Handler tries to query the information from the database. Note that this may not be supported by all databases.

Mode

Enter a string which specifies the mode in which to open the file. Your options are READ, WRITE, FAIL_IF_EXISTS, and CREATE_IF_NEW.

These may be combined by separating them with an ampersand (&), as in "READ&WRITE&FAIL_IF_EXISTS". You can include spaces between the tokens.

If omitted, the open mode defaults to READ & WRITE & CREATE_IF_NEW.

Truncate

Include this parameter to remove all records from a database table. This lets you use dynamic tables with DAL where the tables are created on a fly, records added, and then deleted.

The system returns one (1) if the database table was successfully opened and zero (0) if the table was not opened.

Possible causes of failure include:

Example:

Here is an example:

Procedure Result Explanation
DBOpen ("APPIDX", "ODBC", ,"READ") 1 or 0 Will open the table named APPIDX for reading and associate it with the ODBC handler. Table information will be queried from the database driver, if possible.
DBOpen ("APPIDX", "JDBC", ,"READ") 1 or 0 Will open the table named APPIDX for reading and associate it with the JDBC handler. Table information will be queried from the database driver, if possible

DBOPEN("MYTABLE","ODBC"

,"D:\deflib\mytable.dfd"

,"READ&WRITE&TRUNCATE")

  This DAL statement removes all rows from the table named MYTABLE .