Versions des environnements
Network:
Windows 2003 Server
>>>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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement