Click or drag to resize

DbUnLock Function (Long)

X#
Release all locks or a specified lock for a work area.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax
 FUNCTION DbUnLock(
	nRecord AS LONG
) AS LOGIC
Request Example View Source

Parameters

nRecord
Type: Long
The record number of the record to be locked.

Return Value

Type: Logic
TRUE if successful; otherwise, FALSE.
Remarks
DBUnLock() releases any record or file locks obtained by the current process for a work area. DBUnLock() is only meaningful on a shared database. By default, this function operates on the currently selected work area.
It can be made to operate on an unselected work area by specifying it within an aliased expression
Tip Tip
Shared mode: Releasing locks can cause updates to the database to become visible to other processes.
Examples
The following example illustrates a basic use of the DBUnLock() function:
X#
 1cLast := "Winston"
 2USE sales SHARED NEW VIA "DBFNTX"
 3Sales->DBSetIndex("lastname")
 4IF Sales->DBSeek(cLast)
 5    IF Sales->RLock()
 6        Sales->DBDelete()
 7        QOut("Record deleted: ", Sales->Deleted())
 8        Sales->DBUnLock()
 9    ELSE
10        QOut("Unable to lock record...")
11    ENDIF
12ELSE
13    QOut("Not found")
14ENDIF
See Also