General information
Category:
Coding, syntax & commands
Thanks for replying. Here is the scope on what I am trying to do:
I have a form (FormA) that has two timers (t1, t2). When the formA comes up I fire timer2 (t2) to check if someone has an exclusive lock on a tablex. I am setting exclusive lock on tablex to determine when to fire timer1 (t1) which will run an update process method (I am trying to update tables periodically). If a person does not have exclusive lock on tablex (which is determined through ON ERROR), then I start timer1, else I let timer2 continue monitoring to see if anyone has release a lock on tablex by exiting program.
My program is located on a novell server. I have 25 users accessing this one program on the server though a shortcut on desktop. I only want one person to run my update process method (remember this on updates my tables), but allow all users to access the program. I check to see if someone is exclusive through ON ERROR. If someone has exclusive tablex locked then an error will be generated and T1 will not be fired. Lets say I have User1 and User2. User1 comes in and T2 determines whether Tablex available or exclusive. If available then tablex becomes exclusive to user1 and timer T1 is initiated to run update process method. User2 comes in and tries to lock tablex exclusive but gets an error because tablex was locked exclusively by User1. T2 keeps firing periodically to see if User1 has exited the program or not. If User1 exits the program (I am assuming that releases exclusive lock by terminating program) then User2 will fire T1 when T2 determines that no one has exclusive lock on tablex. My problem is that I can't seem to get exclusive lock on tablex by anyone on the network. Isexclusive() keeps returning .f. If I run multiple copies of this program on my local machine it works flawlessly. If I run this program on network (meaning my program resides on network and user access it through desktop shortcut) the it has a problem as far as locking tablex. Can't you lock a table exclusive on network? Maybe there is a better way to update my tables periodically, but I don't know any other process of automating table updates, do you have a suggestion? I hope I haven't confused you. I am setting USE TABLEX EXCLUSIVE. Here is my code:
*timer2 T2
local worked, isa
with thisform
Worked = .t.
cErrHandler = ON('ERROR')
ON ERROR Worked = .f.
set exclusive on
USE xtable exclusive
isa = isexclusive("xtable",1)
cMessageTitle = 'My Application'
nDialogType = 0
DO CASE
CASE isa = .t.
cMessageText = 'locked'
wait window alltrim(cMessageText) timeout 0.5
CASE isa = .f.
cMessageText = 'no lock'
wait window alltrim(cMessageText) timeout 0.5
ENDCASE
ON ERROR &cErrHandler
IF Worked
bb = '(((((( TABLEX EXCLUSIVE ))))))'
wait window alltrim(bb) timeout 0.9
.T1.enabled = .t. && fires my update process timer1
ELSE
bb = 'oooooo File Not Free ooooooo'
wait window alltrim(bb) timeout 0.9
ENDIF
endwith
Thanks for helping
Nick Patel
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only