Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to capture Sharing Violation error
Message
De
29/05/1998 12:54:25
 
 
À
17/05/1998 05:22:26
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00099769
Message ID:
00103165
Vues:
25
>>I have a single user DOS application which I am now allowing to have a second user with read only rights. Some temporary tables created with sql selects (a cursor won't do since I need to chage some fields) have fixed names and sometimes lead to "sharing violation" errors in Windows 95. Since the goal is not to have to change too much of the code, I need to trap these errors, but don't know how to do it does anybody know how ?
>
>If you're using FPD, you may use Filer to look for "into table", and locate all the places where this happens, then replace real table names with name expressions, or make them cursors and add a line to use the cursors again, when they became read-write. Thus, two approaches, supposing you have a command like
>
>Select .... into table dbfname
>
>In first scenario, this becomes
>
>tempname=sys(3)
>Select ... into table (tempname)
>use (tempname) alias dbfname
>
>In the other scenario
>
>select ... into cursor anyothername
>use (dbf()) again in 0 alias dbfname
>select dbfname
>
>That's all you have to change. Not too much work in both cases; I'd prefer cursors, because they're, by default, created on your temp drive, i.e. not on the server machine (check the config.f* settings on both machines for tmpfiles, sortwork, editwork, progwork), and they're automatically deleted when you close them, keeping the system free of unnecessary files. In cases where the selected data are to be used later, then it'll be tables, of course, but then you must take care that either their names (or location) be different for each user, or use the error routine as described in the rest of this thread.

>Dragan,
>
>Thank you very much for your advice, I like it and will do it that way because it lends itself to the way my program is done. Also thanks for the info on 2.5 to VFP conversion. I will get back to you on that one.
>
>Thanks as well to all ohters who gave ideas, both here and at DevCon.
>
>Alex

Dragan,

I finally tried your suggestions. For your information, the first scenario seems to work, but the 2nd one doesn't.

I also made a small modification in order to for housekeeping to be easier: I set tempfile = SYS(3)+'.tmp'. I am now trying to open it in the tmpfiles directory.

Thank you again,

Alex
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform