lNewAreaTrue opens a new area; false defaults to the current area.
AdvPL GuideDBUseArea( [lNewArea], [cDriver], cFile, cAlias, [lShared], [lReadOnly] ) --> NilOpens a table in a new work area with an owned alias.
DBUseArea returns Nil and requires an available driver, connection and file/table. Default false lNewArea can close the current area: this demonstration chooses true. File paths belong to the server rather than the SmartClient. The fragment only prepares a callback for an owned ED_TEST table already existing in the TOPCONN connection. GetNextAlias supplies the name, opening is shared and read-only, and closing would target the created alias. It creates neither connection nor table. (TOTVS, n.d., ref. 1)
DBUseArea( [lNewArea], [cDriver], cFile, cAlias, [lShared], [lReadOnly] ) --> NillNewAreaTrue opens a new area; false defaults to the current area.
cDriverCompatible RDD; omission uses the configured default.
cFileExisting file/table in driver context.
cAliasAvailable alias owned by the routine.
lSharedShared mode subject to driver and other access.
lReadOnlyRead-only mode.
Nil; the routine must handle failures.
#Include "Protheus.ch"
User Function Ed343()
Local cAlias := GetNextAlias()
Local bOpen
// ED_TEST must exist. Callback is not invoked.
bOpen := {|| DBUseArea(.T., "TOPCONN", "ED_TEST", cAlias, .T., .T.)}
Return NilAlias name obtained and callback prepared; no table opened. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.
© 2026 Usina.BR. All rights reserved. TOTVS, Protheus, Microsiga and their respective logos are trademarks of their owners. AdvPL Guide is independent and uses limited, attributed excerpts justified by educational purposes. See the Terms of Use. Terms of Use
Comments
There are no approved comments yet.
Sign in with Google or Microsoft to comment.