Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change DB from Shared to Exclusive

Status
Not open for further replies.

bonitta

Programmer
Jan 14, 2003
8
0
0
CY
Hi Everybody,

Is there a way to change an open Database status from Shared to Exclusive without closing it?

Thank you in advance..
 
bonitta

Did you try using:

open mydata.dbc shared
open mydata.dbc exclusive

Before posting your question?
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Yes I did, and it doesnt work..

Am testing a Project for Shared access, having a DB already open and using a table from it, I want to have this DB set exclusive after an action, so that other users won't be able to login to the sysem. Opening it again Exclusive looks like it works, but it actually doesn't..
 
bonitta

Opening it again Exclusive looks like it works, but it actually doesn't..

Can you explain what happens when you open it exclusive? Do you get an error? Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
No I don't get an error, it just doesn't open it exclusively. I tested it trying to open the DB as another user and it simply opened without giving an error, which means that the DB is still shared.
 
BONITTA

No I don't get an error, it just doesn't open it exclusively. I tested it trying to open the DB as another user and it simply opened without giving an error, which means that the DB is still shared.

If I open a database (not a table) exclusive, and open a second instance of VFP and try to open the same database shared I get a "access denied" error, not you? Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Yes.. but my question is (I have the Database open shared, I want to keep it open, and make it exclusive provided that no other users have it open beside me).. Is this possible without closing the database and reopening it exclusive?
 
bonitta

Yes.. but my question is (I have the Database open shared, I want to keep it open, and make it exclusive provided that no other users have it open beside me).. Is this possible without closing the database and reopening it exclusive?

As I stated in my first reponse to you, this works exactly like you want
open mydata.dbc shared && Opened shared
open mydata.dbc exclusive && Open exclusive

Without closing the database.


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Hi again,

am working on VFP 6, and tried what u said on VFP 7 to check out if it depends on the version.. Did you try this?

open mydata.dbc shared && Opened shared
open mydata.dbc exclusive && Open exclusive

then open VFP again and:
open mydata.dbc shared

I tried the above, and the DB simply opens with no errors, which means that it wasn't open exclusive. If you even check the following in the first VFP program:

?ISEXCLUSIVE('mydata',2)
this gives .F. which means that it wasn't open exclusive, while if you open it initially exclusive, it gives .T.

Regards,
Maha
 
I have only one Copy of the DB on a Server, which am opening using the whole Path..
 
bonitta

then open VFP again and:
open mydata.dbc shared


Are you opening a second instance of VFP, meaning you are leaving the first VFP opened? Otherwise if you close the first VFP, you are also closing the database.
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Yes I have two instances of VFP Open simultaneously, in the first I open DB shared, then Open it again Exclusive.. Having that done, I open exactly the same DB in the second open VFP and it Opens..

First VFP:

Open Database &MyDb Shared
Open Database &MyDb Exclusive

Second VFP:
Open Database &MyDb Shared

And it actually opens without giving (Access Denied) Error.. Which means that the first instance simply doesn't open the DB Exclusively. Perhaps there is No way to open DB Exclusive after it was open shared? Am using VFP 6.0
 
Well bonitta,

Doing exactly the same on a win xp pro pc gives me an access denied message when opening the database with the
second VFP.
There must be something that causes the first VFP session to close down.

Rob.


 
Hi Rob,

Am working on win2k, FAT32 .. I asked a colleague to test it on WIN2k NTFS and he gets the same results .. I don't know, this just beats me! Perhaps it's cuz ur using win xp?

Thanks for your help though.. Thank you Gagnon..

Regards,
Maha
 
The problem seems to be Win2000 then.
I do not know win2000 but all other versions act "normal".

Find someone who is a win2k expert!

Rob.
 
It is not Win2K, it work just fine.

Check ur project, looks like u have more than one DB set.

Anyhow, if somebody using DB or table, u will not be able to open it exclusive!!! If you dont get error message, nobody use it or it is not data set. It is simple as that.
 
Hi Bonita,

If you need it exclusive after opening the table..
try FLOCK() the table and other can only read the table at the maximum. :) ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com

 
I just did it on a Windows 2000 machine with VFP 6.0:

Instance 1:
open database foo shared
open database foo exclusive

In instance 2:
open database foo

And I got a message "file access is denied".

There's something going on with your computer. It's not a Win2K/Foxpro problem.
Chet Gardiner
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top