Begins transaction logging.


BEGINTRANS([<database name expC> [,<isolation level expN>]])

<database name expC>

The BDE alias of the SQL database in which to begin the transaction.

If <database name expC> is omitted but a SET DATABASE statement has been issued, BEGINTRANS( ) refers to the database in the SET DATABASE statement.

If <database name expC> is omitted and no SET DATABASE statement has been issued, the default database, which supports DBF and DB tables is used.

<isolation level expN>

Specifies a pre-defined server-level transaction isolation scheme.

Valid values for <isolation level> are:




Server's default isolation level


Uncommitted changes read (dirty read)


Committed changes read (read committed)


Full read repeatability (repeatable read)

<isolation level> is not supported for DBF and DB tables.

If an invalid value is given for <isolation level>, a "Value out of range" error is generated.

The <isolation level> is server-specific; a "Not supported" error will result from the database engine if an unsupported level is specified.


If you include <database name expC> when you issue BEGINTRANS( ), you must also include it in subsequent COMMIT( ) or ROLLBACK( ) statements within that transaction. If you don't, dBASE Plus. ignores the COMMIT( ) or ROLLBACK( ) statement.


Separate changes that must be applied together are considered to be a transaction. For example, transferring money from one account to another means debiting one account and crediting another. If for whatever reason one of those two changes cannot be done, the whole transaction is considered a failure and any change that was made must be undone.

Transaction logging records all the changes made to all the tables in a database. If no errors are encountered while making the individual changes in the transaction, the transaction log is cleared with COMMIT( ) and the transaction is done. If an error is encountered, all changes made so far are undone by calling ROLLBACK( ).

All locks made during a transaction are maintained until the transaction is completed. This ensures that no one else can make any changes until the transaction is committed or abandoned.

You can't nest transactions with BEGINTRANS( ). If you issue BEGINTRANS( ) against an SQL database that does not support transactions, or if a server error occurs, BEGINTRANS( ) returns false. Otherwise, it returns true. If BEGINTRANS( ) returns false, use SQLERROR( ) or SQLMESSAGE( ) to determine the nature of the server error that might have occurred.


Call the beginTrans( ) method of the Database object.