Visual FoxPro - File Access is Denied

DavidStein picture DavidStein · Aug 26, 2009 · Viewed 18.5k times · Source

Our ERP system is a hybrid. The actual data is SQL, but the tables which contain user information, profiles, rights, security, etc is in Visual FoxPro.

I need to get exclusive access to the VFP database. I remove everyone from the system using the program itself, and it indicates everyone is out of the system. I get the following response to the following code:

set excl on
open data l:\M2MDATA\Util\util.dbc excl

The response I get is : File Access is Denied. I went into server manager and nobody has any files open in our VFP directory.

Is there a command in VFP that will allow me to determine who/what has the file open and/or a way to kill any sessions within FoxPro that do?

I tried googling it but had no luck.

Answer

Rick Schummer picture Rick Schummer · Aug 28, 2009

You might want to check out the Process Explorer from Sysinternals (Microsoft).

http://technet.microsoft.com/en-us/sysinternals/default.aspx

You can use the Find | File Handle or DLL menu option and put in the name of the DBC file. Process Explorer will tell you the process ID and the process that has the file open.

If you are sharing the file on the network (file server or peer-to-peer), head over to the "server" and run Computer Management. Drill down into the Shared Folders > Open Files and you should hopefully see the list of files opened on the computer by other users on the network.

Rick