Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to verify table can be opened exlcusive
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01192195
Message ID:
01192222
Vues:
15
>>>Hi, I need to run a scheduled mainteance routine to reindeix all the tables after operating hours. I need to use the table exclusively in order to reindex. I have problem knowing whether the table has been used by user before issuing the command "use mytable exclusive".
>>>
>>>Any suggestion?
>>>
>>>Thanks
>>>
>>>james
>>
>>The simplest solution would be TRY and CATCH. I don't remember whether that was introduced in VFP 8 or 9; for older versions, use ON ERROR.
>
>VFP8 :-)
You can use on error like this:

local llCanProceed,lcOldErr
lcOldErr=''
lcOldErr=on('error') && buffer old error routine
on error llCanProceed=.f.
llCanProceed=.t.

*- now try to open table
use lcTable excl
if not(llCanProceed)
=messagebox("Please close Table: lcTable",64,"CANNOT PROCEED")
else
*- do what you need to do, because table is now open exclusively
endif

*- Now set error routine back to what it was prior to call
if not empty(lcOldErr)
on error &lcOldErr
else
on error
endif

HTH,
Mike
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform