Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Exclusive
Message
De
13/03/2006 13:41:53
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Versions des environnements
Visual FoxPro:
VFP 6
OS:
Windows XP SP1
Network:
Windows 2000 Server
Database:
MS SQL Server
Divers
Thread ID:
01103719
Message ID:
01103878
Vues:
10
>Hi All,
> How can I determine programically if the .dbc is open exclusively and who has it open.
>
>thanks

Hi Mahmood,

To ckeck if a DataBase is open i would do the following:
TRY
    open database <DatabaseName> exclusive
CATCH to oerr
    if oerr.errorno = 1705
	= messagebox("Someone is using the database", 48,"Error")
    else
	= messagebox(transform(oerr.message),48,"Error")
    endif
FINALLY 
    close databases
ENDTRY
or
  m.errorStat = .f.
  on error m.errorStat = .t.
  open database <DataBaseName> exclusive

  * If database is in use there will be an error
  * and variable m.errorStat will have the .t. value
  if m.errorStat = .t.
    = messagebox("Error opening the database")
  else
    = messagebox("Database opened sucessfully")
  endif
I can't help you in the subject of knowing who has open the DB.

Joaquim
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform