4D v16.3

OPEN DATABASE

Home

 
4D v16.3
OPEN DATABASE

OPEN DATABASE 


 

OPEN DATABASE ( filePath ) 
Parameter Type   Description
filePath  String in File name (.4db, .4dc, .4dbase or .4dlink) or complete access path of database to open

The OPEN DATABASE command closes the current 4D database and opens on-the-fly the database defined by filePath. This command is useful for automatic testing purposes, or to reopen a database automatically after a compilation.

In the filePath parameter, pass the name or full access path of the database to be opened. You can use files having one of the following extensions:

  • .4db (interpreted structure file),
  • .4dc (compiled structure file),
  • .4dbase (OS X package),
  • .4dlink (shortcut file).

If you pass only a file name, this file must be placed at the same level as the structure file of the current database.

If the access path defines a valid database, 4D quits the database that is already open and then opens the specified database. In single-user mode, the On Exit database method of the database being closed and the On Startup database method of the database being opened are called successively.

Warning: Since this command causes the application to quit before re-opening with the specified database, it is not recommended to use it in the On Startup database method, or in a method called by this database method.

The command is executed in an asynchronous manner: after its call, 4D continues executing the rest of the method. Then, the application behaves as if the Quit command was selected in the File menu: open dialog boxes are cancelled, any open processes have 10 seconds to finish before being terminated, and so on.

If the target database file is not found or is invalid, a standard file system error is returned and 4D does nothing.

This command can only be executed from a standard database. If it is called from an engined application (single user or server), the error -10509 "Can't open database" is returned.

Example  

 OPEN DATABASE("C:\\databases\\Invoices\\Invoices.4db")

 
PROPERTIES 

Product: 4D
Theme: 4D Environment
Number: 1321

 
HISTORY 

Created: 4D v14 R3

 
ARTICLE USAGE

4D Language Reference ( 4D v16)
4D Language Reference ( 4D v16.1)
4D Language Reference ( 4D v16.2)
4D Language Reference ( 4D v16.3)