Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
USED() @ Network
Message
From
16/11/2006 04:01:21
 
 
To
15/11/2006 22:51:34
Ed Hizon
Skswood Sdn. Bhd
Kuala Belait, Brunei
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01170139
Message ID:
01170172
Views:
11
Hello,

I've had similar problems with DBF files being opened exclusively over the network.

As far as I am aware USED() will only tell you if a table alias or workspace is in use within your current VFP session; I'm not sure if there is a similar command for database containers (DBC).

There are two paths I usually take with this problem.

1) Locate the person who has exclusively opened the table or database

or

2) Programmatically check if the table or database is exclusively opened outside of my VFP session.

For option 1) you will need the help of your system administrator.

Firstly make a note of the server or workstation that holds your DBC file on the network.

Secondly connect to that server or workstation (this is where you may need your system administrator to assist) and go to the Control Panel - Administrative Tools - Computer Management - Shared Folders - Open Files

You should be able to see your DBC and related files displayed in a list alongside the user name who is currently using that file. YOu can then contact them and ask them to close the file.

For option 2) I run code similar to the following; this allows me to step out of code if the database or table cannot be opened.
LOCAL 	lnFileHandle, ;
		lcFileName

lcFileName = "\\MyServerName\MyShare\MyDatabases\MyDatabase.DBC"

lnFileHandle = FOPEN(lcFileName)

IF lnFileHandle <= 0
	*-- An error has occured trying to FOPEN() the DBC
	*-- This 'may' be caused by the database being used 
	*-- exclusively elsewhere... it could also be caused
	*-- by an error in the path/filename referenced in
	*-- lcFileName
	
	=MESSAGEBOX(lcFileName+" may be opened exclusively elsewhere!")
ELSE
	=FCLOSE(lnFileHandle)
	
	=MESSAGEBOX(lcFileName+" is not exclusively opened elsewhere!")
ENDIF
I hope this helps,
Ben Sugden

"Remember to enjoy hunting - and that means relishing the search for the product that has never been advertised or placed handily at the front of the shop; Life begins on the uppermost shelf, avoid guide books and top 10's like the plague." - Ramsey Dukes
Previous
Reply
Map
View

Click here to load this message in the networking platform