Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Forgot to handle 1705
Message
De
29/10/1998 08:58:40
 
Information générale
Forum:
Visual FoxPro
Catégorie:
FoxPro 2.x
Divers
Thread ID:
00152055
Message ID:
00152236
Vues:
23
>>ar>>I have an application that's not coded correctly
>>>>to handle error 1705, which happened when you try
>>>>to open a DBF that has been exclusively opened by
>>>>another application.
>>>>
>>>>use dbfname shared
>>>>* the codes assumed 100% successful open
>>>>replace field1 with value1
>>>>
>>>>They should have trapped the error and then check
>>>>USED("dbfname") before doing anything (like the
>>>>followings).
>>>>
>>>>on error do errhand with errproc()
>>>>use dbfname shared
>>>>if !used('dbfname')
>>>> return .f.
>>>>endif
>>>>replace field1 with value1
>>>>
>>>>procedure errproc
>>>>parameter m.error
>>>> if m.error=1705
>>>> return
>>>>
>>>>Is there a simple way to work round this problem without
>>>>the need to insert extra codes after _every_ USE sections
>>>>in the system? There could be a hundred of this sections
>>>>littering everywhere in the system.
>>>
>>>PROCEDURE mainprogram
>>>ON ERROR DO errhandler WITH ERROR()
>>>USE dbfname IN 0 shared
>>>
>>>
>>>PROCEDURE errhandler (nerror)
>>>DO CASE
>>>CASE nerror = 1705
>>> WAIT WINDOW 'File is being in used by another user. Retrying access...' NOWAIT
>>> RETRY
>>>CASE nerror = etc.
>>>
>>>
>>>ENDCASE
>>
>>Careful with this... users don't like an endless loop that they can't escape from.
>
>Hmmmm... Then I leave it to the developer's decision if He/She will adopt the same approach. Mine is just sharing the logic behind on how we handle the scenario.

My error handler gives the user a choice to retry or quit. This way, if he knows who has the file open exclusively, he can close it and continue, but if he doesn't he can alwaya cancel the operation.
Erik Moore
Clientelligence
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform