Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
File is in Use by Another User
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00676168
Message ID:
00676200
Vues:
15
AFAIK Insert command locks the table header, thus the Error you're getting. You may surround your insert with explicit flock() or try to use this table in buffering mode and then tableupdate. I think, the first method would be better.

>The Error : "File is in Use by Another User"
>
>How it occurs....
>
>I have a File I call "AuditBat" which has the code below... it is called by various Batch Files that run during the day and night... and some start at the SAME TIME...
>
>Here is AuditBat code..
>
>*****************************************************************************
>
>
>PARAMETERS psProgName, psStatus, pdStartDate, psStartTime
>
>IF TYPE('psProgName') # 'C'
>	RETURN
>ENDIF
>IF TYPE('psStatus') # 'C'
>	RETURN
>ENDIF
>IF TYPE('pdStartDate') # 'D'
>	RETURN
>ENDIF
>IF TYPE('psStartTime') # 'C'
>	RETURN
>ENDIF
>
>LOCAL lcExclusive
>STORE SET('EXCLUSIVE') TO lcExclusive
>SET EXCLUSIVE OFF
>
>IF NOT USED('auditbat')
>	USE \\rsvpsource\wrktest\programs\auditbat IN 0 ALIAS auditbat SHARED
>ENDIF
>SELECT auditbat
>
>IF UPPER(ALLTRIM(psStatus)) = 'START'
>	INSERT INTO auditbat (progname,   startdate,   starttime) ;
>	       VALUES        (psProgName, pdStartDate, psStartTime)
>ELSE
>	IF UPPER(ALLTRIM(psStatus)) = 'END'
>	UPDATE auditbat	SET EndDate = DATE(), EndTime = TIME() ;
>	  WHERE Progname = psProgName AND StartDate = pdStartDate AND StartTime = psStartTime
>	ENDIF
>ENDIF
>
>SELECT auditbat
>USE
>
>SET EXCLUSIVE &lcExclusive
>RETURN
>
>*********************************************************************************
>
>The error occurs in line 48
>
>
>	INSERT INTO auditbat (progname,   startdate,   starttime) ;
>	       VALUES        (psProgName, pdStartDate, psStartTime)
>ELSE
>
>*********************************************************************************
>
>Most of the time, there is NO error...and there are 2 batch programs that ususally start at the SAME TIME, and most of the time, there is no ERROR... but once in a while there is.
>
>I noticed that I caused an error today when I opened the AUDITBAT and ERRLOG table in SHARED mode, and whatched what would happend at 11:30 this morning when both batch files started to run.... an ERROR occured!
>
>Any ideas? Sharing vs Exclusive mode for the INSERT and UPDATE commands??
>
>Thanks for any ideas!
>
>Tommy
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform