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

index error occurs only in executable 2

Status
Not open for further replies.

CJMK

Programmer
Jul 2, 2014
30
US
Program works fine in VFP9, but causes 114 error (Index does not match the table. Delete the index file and re-create the index.) when compiled into .exe by innosetup. If that had worked, of course I wouldn't be here. Deleted cdx and rebuilt. zapped table and appended from backup didn't work either. At first, it happened only when I issued close databases all. It then closed all but the one file and errored out on that. I fixed that by closing all tables sequentially, which apparently worked. But now it does it again on start up when I open the table.
 
When something works in the development environment but not in an executable (or vice versa), it is usually because the executable is accessing a different copy of the table or the index file. And, when that happens, it is usually because of a pathing issue.

So the first thing to check is whether you have multiple copies of either the DBF or CDX on the computer. If you have, check the paths to those files and how they are being located. For example, is the DBF present in the data environment of a form? If so, VFP will look for it in the path indicated by the Database property (of the cursor).

If it can't find it there, or if the file is not in the data environment, VFP will look in the default directory, and then in the search path. The default directory is the directory from which you launch the development environment or the executable as the case may be. These are not necessarily the same.

The search path is defined by SET PATH. If that is not present, it is the path defined in Tools / Options / File Locations in the development environment, but in an executable.

My point is that it is not always obvious which copy of a file you are accessing or where it is located. So that should be the first thing to check when dealing with this kind of error.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Your description reads vague.

CJMK said:
when compiled into .exe by innosetup
1. You build an EXE with VFP
2. You create a setup with innosetup.

I'm not sure what operations you do with the table and therefore its index. If you embed a table into an EXE ,it's automatically a read-only table, whenever you'd change the table contents neither the DBF embedded in the EXE nor the accompanying FPT or CDX files can update, because an EXE is executable, but readonly.

If you want to use data keep it excluded from the exe and have data files in the setup with an installation target folder that must be writable to the end user and not only for the setup during installation.

Also be sure what files you need to install. Installing tables with indexes is no problem. You can save setup size if you just let indexes be created during or after the setup, but then you might have made a beginner mistake to only provide DBF files in the setup, indexes are in sperate files, some field types like memo or also. A table can consist of a bunch of files, most often dbf,fpt,and cdx, but you can have more idxes, secondary cdxes. As developer you should keep all these in a data directory and add that to a setup to be installed into a single users or all users appdata, as one example, or a share for a networked multi user database.

Not sure, since installing only the DBF of a table with a CDX would trigger missing cdx file or a similar message and not index doesn't match table). You seem to do something the finally has the wrong file combination of dbf and cdx.

Chriss
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top