DBUsed()

This function tells you whether a specified database is open. It's the equivalent of USED() for database containers.

Usage

lInUse = DBUSED( cDatabase )
Unlike many other functions, this one doesn't have a default result if you omit the parameter. Calling DBUSED() without a parameter results in an error message.

DBUSED() incorrectly returns .F. if the database is open but isn't in the current directory and you specify an extension but no path (for example, "TESTDATA.DBC").


We haven't found a whole lot of uses for this function. We suspect it's more useful in developer tools, where you want to manipulate a particular database, than in client applications. One use in both situations, though, is to double-check that a particular database is still open before you try to SET DATABASE TO it.

Example

CLOSE ALL
CD HOME()
? DBUSED("TasTrade")      && Returns .F.
OPEN DATA _SAMPLES + "TasTrade\Data\TasTrade"
? DBUSED("TasTrade")      && Returns .T.
? DBUSED(DBC())           && Returns .T.
? DBUSED("TasTrade.DBC")  && Returns .F. -- bug!
CLOSE DATA
USE Customer              && Automatically opens database
? DBUSED("TasTrade")      && Returns .T.

See Also

ADatabases(), DBC(), Open Database, Used()


Back to Table of Contents

Copyright © 2002-2018 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. Click for license .