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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error cannot update the cursor, table name is read only

Status
Not open for further replies.

zhed0708

IS-IT--Management
Jun 25, 2011
41
PH
plz help me...
i have a vfp project in it is already finished. i build my main program and run it, it is pretty good. no errors and etc. but when i compile it using INNO setup,(during the process of compiling there is no error found) and install and run my application, i met error like cannot update the cursor, table name is read only. i cannot save or what so ever. i cannot change my data in my table. i excluded my table in my project, unchecked the read only file in the folder of my table but still i get the error...plzzzz help me...i need it to fix to submit my application. thanx for advance.....
 
A setup installs into the program files directory and a normal user has no write permissions there. You need to put your data in the user documents folder for example, somwhere, they can write to.

Bye, Olaf.
 
The first thing you need to do is to determine whether the table really is read-only.

You say you "unchecked the read only file in the folder". Did you do that to the actual DBF (as opposed to the folder that contains it)? And also to its accompanying CDX adn FPT (if any)? And also to its containing DBC (if any)?

If all those files have the read-only flag clear, can you try updating the file from outside your application? For example, copy the file to a computer that has VFP installed, and just try browsing it and changing any value.

If you could let us know the results of these tests, we can take it forward.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
thanx for the reply...i will checked for your suggested solution and i will inform you if what would be the result..

thanx.......

zhed
 
sir mike,....

my table and database is not a read only but my folder containing those table and database is read only.. i try to uncheck it but no matter i uncheck it, it will return to a read only.. what should i do?

zhed
 
Zhed,

I think Olaf gave you the right answer - especially if you are running on Windows Vista or 7.

If the data files are in a directory below Program Files, they need to be moved somewhere else. The best thing is to create a separate directory, either just below the root, or below the user's Application Data folder.

You will also need to change your application so that it knows where to look for the files.

The point is that, under Windows Vista and above, we are not supposed to be able to create, update or delete files in Program Files. There are workarounds for that, but the best solution is to put your data files somewhere else.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
sir mike,...

yuh....i'am using windows 7..and my vfp project folder is in the local disc C for the default path. you mean sir that i will be placing my project folder in other directories like my document or other drives?

zhed
 
Zhed,

You mentioned the "VFP project folder". The project folder has got nothing to do with the issue we are discussing. The project folder is where you keep your source files, such as PRGs, forms, reports, etc.

When you build the application into an EXE file, you give the EXE to your users. The users don't want - and shouldn't have - your project folder. It's not relevant to them.

It's the folder that contains your executable program, that is, the EXE file, that is normally installed under Program Files. That's OK. This folder might also contain subsidiary files, like a Help file, or perhaps some runtime components.

What that folder should not contain is the data. You must put your data in a directory outside of Program Fiels. It could be under My Documents if you like; or Application Data; or directly below the root.

The choice will depend in part on who is actually going to use the application (and the data). If the data "belongs" to a specific user - if it is personal to them - it could go in My Document. If it is to be shared, it should go somewhere else. In fact, shared data usually sits on a server or other shared resource, for obvious reasons.

Does that help at all?

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Let me get this straight: Yo're not having any problems with your project folder in development. You're only having the problem for the installed application, and you have a data folder within /program files/ when the application has installed.

You can let INNO install parts of your files (EXE and other executable stuf, eg runtimes) into the official /Program Files/ directory, and let it install data files (DBC, DBFs etc) into the common documents or user documents folder, depending on your app adressing multiple users or single user, and if single user, dpending on availability for all users of the pc or really only a single user. If multi user, you should also think about enabling the user to install your database into a network share to share data with ultiple users in a LAN.

If you install the whole stuff to a users docuemtns folder that would also work, but it's not the idea of MS about program installations and their protection and the other disadvantage is, only that user would then see iut and be able to use it.

Bye, Olaf.
 
sir,,..
you are both correct for the vfp project folder...there's nothing to with it...but when i use INNO software to compile my vfp project, there is part when he ask to add files and folders. i add my exe file and other files that are outside the folder and also the folder like the data,form,menus, etc.. then ask if "should files in sub folders of "C:\Users\hedz\desktop\system\data" also be included?"
i choose yes, and i edit the folder name that would be seen in the program file.but the destination base folder is in application directory. should i place to other directory in order my data folder would not be read only?

zhed
 
Zhed,

You said " when i use INNO software to compile my vfp project, there is part when he ask to add files and folders. i add my exe file and other files that are outside the folder and also the folder like the data,form,menus, etc..

That is wrong. You should NOT add the forms, menus, etc to the INNO script.

Your INNO script should contain only the following:

- Your EXE file (which you can place in a directory below Program Files)

- The VFP runtime files (which can be in the same directory as the EXE)

- The data file (which should be in any directory outside of Program Files)

- Any other files we don't know about.

If you focus on getting that right, you will be nine tenths of the way to solving the problem.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
In regard toy our last question: Yes, you should put the data folder somewhere else not read only, I already gave you some places to choose from. And Mike also is right, all your forms and other source code is compiled into the exe and does not need to be deploayed at all.

Bye, Olaf.
 
sir MikeLewis ....

in the statement you said "The data file (which should be in any directory outside of Program Files)", i tried this, putting my data folder outside the program files but still don't work. when i run my application, it cannot continue because it searches my database.

"i choose yes, and i edit the folder name that would be seen in the program file.but the destination base folder is in application directory. should i place to other directory in order my data folder would not be read only? "

zhed
 
sorry sir for the incomplete message....

what i said about the application base folder has this choices:application directory,program files directory,common files directory,windows directory,windows system directory,setup source directory,system root drive directory,common start up directory,user start up folder and custom.

the default directory which i usually use is the application directory..but this time it doesn't work to my application. which should i use in order my data folder doesn't a read only.


zhed
 
i choose yes, and i edit the folder name that would be seen in the program file.but the destination base folder is in application directory. should i place to other directory in order my data folder would not be read only? "

I hardly understand what you want to sqay with this.

>i choose yes
You choose yes, yes as the answer to what question?

>i edit the folder name that would be seen in the program file.
What did you change? Who/What is seeing something in program file?

>the destination base folder is in application directory.
the destination base for the whole installation or for the data? You can make part of your files (EXE, runtimes) go into program files, and other parts (data) go into other folders. User Documents is more appropriate, as Windows Appdata rather means configuration data, the database is for a data based application what docuements are for office applications, so rather put it into common documents or a server share.

To make your dataenviroinments see the database add the path to SET PATH, then VFP will find the dbc and dbfs there. Of course you need to know, where the data was installed, so let INNO perhaps write that directory somewhere you can read in, eg that can be written to program files, as you only need to read that configuration path, you can also determin the path as INNO does, by calling system functions returning the path of system folders like the ALL USERS/PUBLIC DOCUMENTS folder.

See
You could extend tha with CSIDL_COMMON_DOCUMENTS: #define CSIDL_COMMON_DOCUMENTS 0x002e

Add a case for the iput parameter "COMMONDOCS" to use that CLSID.

In short: You'd not hardcode the path, but let windows tell you where that folder is, INNO installed into.

Bye, Olaf.
 
Zhed,

Sorry, I'm getting lost. When do you mean when you said "I choose yes"? Choose it where?

Let's do it this way. In your Inno script, you have a [Files] section. In that section, you have a line something like this:

Code:
Source: "c:\MyProject\Data\*.*"; DestDir: "{app}\Data";

You need to change the DestDir clause in that line. You need something like this:

Code:
Source: "c:\MyProject\Data\*.*"; DestDir: "c:\MyData";

where c:\MyData is the directory on the user's system where your Setup program will install the data.

(In practice, you should ask the user where they want the data installed, but let's take one step at a time.)

Now, when the user runs the Setup program, they should get the data stored in c:\MyData, which should not be read-only.

But you still have another step. You have to tell your application where the data is now stored. Instead of having to tell it to look in a data directory below the application directory (which is below Program Files), you have to tell it to look in c:\MyData. The easiest way to do that is with this command:

Code:
SET PATH TO c:\MyData ADDITIVE

Remember, c:\MyData is just an example. Choose whatever directory name is sensible to your application.

Could you try to doing that. If it doesn't work, it would also help if you could show us the relevant lines from your Inno script.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
sir MikeLewis...

here is my code...should i change my code with your code?

IF _VFP.STARTMODE = 0 && running inside the Visual FoxPro IDE
lcPath = LEFT(SYS(16,0), RAT("\", SYS(16,0), 2))
SET DEFAULT TO (lcPath) && Specifies the default drive and directory
SET PATH TO (lcPath + ";data\;form\;project\;reports\;picture\;menus\") && Specifies a path for file searches
ELSE
lcPath = JUSTPATH(SYS(16,0))
SET DEFAULT TO (lcPath) && Specifies the default drive and directory
SET PATH TO (lcPath + "data\;form;picture\") && Specifies a path for file searches
ENDIF

zhed
 
Zhed,

This line needs changing:

Code:
SET PATH TO (lcPath + "data\;form;picture\")

That line says that your Data directory is below the directory in lcPath, which is the directory from which the application was launched.

As I and others here have said several times, you need to put your Data directory somewhere else. You should remove "data\" from this command, and then add the SET PATH command I showed you earlier.

But that only solves the second part of the problem. You still need to tell Innot to install the data files in the right place, as we have been trying to explain.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
sir......

thanx a lot for all of your effort in helping me..sir mike..thanx..your suggestion finally worked..i change the path of my data in my main.prg and to the inno script...i can now manipulate the records to my database...thanx for your help...

zhed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top