Article ID: 138613
Article Last Modified on 8/26/1999
Lock table record
Write table record
Lock memo file
Write memo file
Lock index file
Write index file
Lock table record
Lock memo file
Lock index file
Write table record
Write memo file
Write index file
*:*************************************************************************
*:*: Procedure File Server.prg
*:*************************************************************************
*: SERVER
SET SAFETY OFF
SET EXCLUSIVE OFF
CLOSE DATA ALL
IF FILE('TSTSRVER.dbc')
DELETE DATA TSTSRVER DELETETABLES
ENDIF
=SYS(3052,1,.T.)
=SYS(3052,2,.T.)
CREATE DATA TSTSRVER && Creates a database and a table
CREATE TABLE xxx (dbkey i PRIMARY KEY, field2 c(5), field3 m)
INSERT INTO xxx VALUES (1, 'aaaaa', 'long string 1')
INSERT INTO xxx VALUES (2, 'bbbbb', 'long string 2')
INSERT INTO xxx VALUES (3, 'ccccc', 'long string 3')
INSERT INTO xxx VALUES (4, 'ddddd', 'long string 4')
INSERT INTO xxx VALUES (5, 'eeeee', 'long string 5')
CLOSE DATA ALL
OPEN DATA TSTSRVER SHARED
=MESSAGEBOX('Start the Client program on the second instance now.')
USE xxx SHARED && Executes after the Client program is started
BEGIN TRANSACTION
GOTO 2
REPLACE field3 WITH 'Changed String'
SKIP
?'Return to client and press ok.'
*:*************************************************************************
*: Procedure File Client.prg
*:*************************************************************************
*: CLIENT
SET SAFETY OFF
SET EXCLUSIVE OFF
CLOSE DATA ALL
=SYS(3052,1,.T.) && Changes the lock and write order
=SYS(3052,2,.T.)
USE XXX SHARED
=MESSAGEBOX('Switch to server and press OK')
GOTO 1
REPLACE field3 WITH 'Changed String from client'
SKIP
When these programs are run, the message "Attempting To Lock. Press Cancel"
is displayed. When you press the ESC key, the error "Record is in Use by
another user" appears, or your ON ERROR routine is triggered.
Additional query words: VFoxWin rlock flock locking
Keywords: KB138613