Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Exclusive
Message
From
13/03/2006 13:41:53
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Environment versions
Visual FoxPro:
VFP 6
OS:
Windows XP SP1
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01103719
Message ID:
01103878
Views:
9
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform