Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Use Tables Exclusive
Message
 
 
À
22/12/2003 18:39:36
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00861446
Message ID:
00861920
Vues:
32
Thanks
I just modified your code so I can open a list of tables stored in table.
Thanks again
*-----------------------------------------------------------*
Local lnError, mytable
Store 0 To lnError, lnCounter
ON ERROR LNERROR = ERROR()
USE UPD_TABLES ORDER NAME
SCAN
mytable = ALLTRIM(UPD_TABLES.NAME)
myorder = ALLTRIM(UPD_TABLES.ORDER)
SELECT 0
IF EMPTY(myorder)
USE (MYTABLE) EXCLUSIVE
ELSE
USE (MYTABLE) ORDER (MYORDER) EXCLUSIVE
ENDIF
DO WHILE LNERROR <> 0
=MESSAGEBOX("Could not Open Table :- "+ UPPER(MYTABLE) + CHR(13) + ;
"ALL USERS SHOULD BE OUT OF THE SYSTEM NOW, " + CHR(13) + ;
"Press OK to Try to Open the Table Again....",0+16)
LNERROR = 0
IF EMPTY(myorder)
USE (MYTABLE) EXCLUSIVE
ELSE
USE (MYTABLE) ORDER (MYORDER) EXCLUSIVE
ENDIF
ENDDO
ENDSCAN
USE IN UPD_TABLES
ON ERROR
*-----------------------------------------------------------*


>>I need to open the tables exclusively in a form that contains alot of update operations on different tables, the problem is how to open all of my tables sucessifully if other users in the system, so I need to give the user a message and try to open the failed table again until I open all of my tables.
>
>you could attempt the open the table exclusively and trap any errors that occur., e.g.
>
Local lnError, lnCounter
>Store 0 To lnError, lnCounter
>On Error lnError=Error()
>Use mytable Exclusive
>Do While lnError<>0 And lnCounter<1000 && only try 1000 times before giving a message to user
>  lnError=0
>  lnCounter=lnCounter+1
>  Use mytable Exclusive
>EndDo
>If lnError<>0 Or lnCounter>=1000
>  Messagebox("Could not open table.")
>EndIf
>On Error
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform