<< Click to Display Table of Contents >> Navigation: Apollo VCL Components > Apollo VCL Component Reference > TApolloTable > TApolloTable Methods > Unlock |
Declaration
procedure Unlock( lRecNum: LongInt );
Description
Removes specific record and/or file locks from the current work area.
In earlier releases, this function was, for the most part, simply remapped to call TApolloTable's Post method, and was included to assist in migration from xBase syntax. That behavior precluded the use of Apollo's multiple record-locking functionality and so this method has since been changed. The new RLock behavior locks the rocord but it does not place the record in Edit mode. Therefore, before updating a records in this way, you should either set SpeedMode to True, or just use the Edit method instead. You should generally only call RLock directly when you require multple records locked at the same time, or when using SpeedMode on a shared table. Multiple record locking is not available under Delphi 3.x.
Parameters
lRecNum: Indicates the specific record number to be unlocked. Passing a zero (0) unlocks all records and removes any file lock.
Delphi Example
with ApTbl do
begin
SpeedMode := True;
if RLock( RecNo ) then
begin
StrPCopy( cpTemp, BoxName.Text );
Replace( 'NAME', R_CHAR, @cpTemp );
Unlock( RecNo );
end
else
ShowMessage( 'Record lock failed' );
SpeedMode := False;
end;
C++Builder Example
ApTbl->SpeedMode := TRUE;
if (ApTbl->RLock( ApTbl->RecNo ))
{
StrPCopy( cpTemp, BoxName->Text );
ApTbl->Replace( "NAME", R_CHAR, cpTemp );
ApTbl->Unlock( ApTbl->RecNo );
}
else
ShowMessage( "Record lock failed" );
ApTbl->SpeedMode := FALSE;
See Also
FLock, Locked, LockCount, LockList, RLock, SetLockTimeout
SetLockTimeout