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!

read only- Modify structure

Status
Not open for further replies.

doton

Programmer
Feb 27, 2019
14
MX
All files are only read only. need to codiefed modifiy strucure,but all are read only.
 
USE <Tablename> EXCLUSIVE


Best Regards,
Scott
MSc ISM, MIET, MASHRAE, CDCP, CDCS, CDCE, CTDC, CTIA, ATS

"I try to be nice, but sometimes my mouth doesn't cooperate.
 
Do yo mean that they are read-only within Windows? If so, right click on the file in Windows Explorer or File Manager, select Properties, and remove the tick against "read only".

Or do you mean that they are opened for shared use within VFP (which is definitely NOT the same as read-only). If so, make sure no other users are using the file in question, then close it in your session, then open it again using the code that Scott showed in his post above.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
The simplest thing you can do is create a project and add dbc(s) and dbfs to it, then use the MODIFY button on a table you want to modify the structure.

You'll see this echo some commands to the command window, then:
Code:
USE table1 EXCLUSIVE IN 0
SELECT Table1
MODIFY STRUCTURE

So Scott is giving you the most important advice: EXCLUSIVE.
You get (Read Only) in the title of the table designer window if you only have a DBF opened SHARED.

Mike gives another very simple reason why a dbf only opens read-only when it has the read-only file system attribute set. But the more common case is only getting shared access, someone would need to intentionally set the attribute to data and I don't see a large use case for read-only files. A word dictionary? Even such meta-data will usually be open to slight changes, additional records, so it will not be flagged read-only in the file system.

A developer would rather keep a database in his local development folder to keep it away from users and always have exclusive access. And you should, too. That doesn't make it a simple case for getting that modified structure to production, because the current data is still the one in the file share you don't get exclusive hands-on without ending user sessions.

I assume you're not the original developer of this. Well, look out for documentation of procedures/handling of such situations. A good developer will have foreseen a way to quit all current users running the application to be able to apply changes to the database and provide a new EXE.

Bye, Olaf.

Olaf Doschke Software Engineering
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top