none
Index does not match database.

    Question

  • Hi all;

    I have one place in my code where a replace command will once in a blue moon trigger this error. Now, I know what the error means but I can't understand why this would happen.
    Its a very simple form which does something like this:
    use somefile
    set order to someorder
    replace status with somestatus

    The replace command triggers the error but not often at all.

    Any ideas or points would be appreciated.


    • Changed type Martin_Xie Thursday, March 11, 2010 7:17 AM Change to comment due to no follow-up.
    • Changed type Martin_Xie Thursday, September 16, 2010 2:00 PM Reopen this question.
    Friday, March 05, 2010 5:10 AM

Answers

  • I encountered a file with the following index tag:

    INDEX ON PADL(DTOS(DATE)+PADL(ALLTRIM(STR(HOUR(CTOT(TIME)))), 2, "0")+PADL(ALLTRIM(STR(MINUTE(CTOT(TIME)))), 2, "0"), 12, "0")+DATETIME TAG timeord

    If I try and use the table in VFP 9 with STRICTDATE SET TO 2, I get the error "Index does not match the table.  Delete the index file and re-create the index"

    If STRICTDATE SET TO 1 or 0, you don't get the error.

    Could your index problem be related?

    Wednesday, September 15, 2010 2:02 PM

All replies

  • 1. Could the table be already corrupted?

    2. Are you using non-fixed length index expression in your table?
    Premature optimization is the root of all evil in programming. (c) by Donald Knuth

    Naomi Nosonovsky, Sr. Programmer-Analyst

    My blog
    Friday, March 05, 2010 5:53 AM
    Moderator
  • Most likely the index is corrupted. Recreate it.
    Craig Berntson
    MCSD, Visual FoxPro MVP
    INETA Regional Speaker
    www.craigberntson.com
    Friday, March 05, 2010 4:12 PM
  • We are changing the issue type to “General Discussion” because you have not followed up with the necessary information. If you have more time to look at the issue and provide more information, please feel free to change the issue type back to “Question” by clicking "Change Type" at the top of the thread. If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Thursday, March 11, 2010 7:16 AM
  • Table is not corrupted. But the index apparently is or doesn't match the database. The question is why would the index change? I'm using a cdx which should be maintained by vfp... Indexes are fix length.

    Thanks.
    Friday, March 12, 2010 7:51 AM
  • you can use
    VALIDATE DATABASE
    to know the problem.
    Friday, March 12, 2010 8:30 AM
    Answerer
  • There are many things that can corrupt an index. Anything from the user turning off the PC before properly exiting the program to coding errors to a poorly designed application to bad network wiring to improperly configured disk controllers and network cards. Follow my previous advce.
    Craig Berntson
    MCSD, Visual FoxPro MVP
    INETA Regional Speaker
    www.craigberntson.com
    Friday, March 12, 2010 4:15 PM
  • Craig;

    I do know that things like bad wiring/hardware failure can cause corruption. In this case however I don't think these are the causes.
    Since this was my first ever VFP app, I would probably put the cause under poorly designed application :-)
    I do recreate the index, but I would like to know what causes the corruption. So if I may pose another question: How can the application itself cause the corruption since I simply use a CDX file which is maintained by vfp? Is it possible to cause a corruption of the index by using a modal form on top of another form - both editing the table?
    I'm just trying to figure out what causes this corruption.

    Thanks again for the advise.
    Friday, March 12, 2010 9:56 PM
  • Normal use of a VFP app should never corrupt an index. Usually, corruption comes from outside (that is, hardware-related) sources.

    Tamar
    Monday, March 15, 2010 8:46 PM
    Answerer
  • Thanks Tamar - I thought this is the case. So I guess I'm back to step one :-)
    Tuesday, March 16, 2010 3:31 AM
  • I encountered a file with the following index tag:

    INDEX ON PADL(DTOS(DATE)+PADL(ALLTRIM(STR(HOUR(CTOT(TIME)))), 2, "0")+PADL(ALLTRIM(STR(MINUTE(CTOT(TIME)))), 2, "0"), 12, "0")+DATETIME TAG timeord

    If I try and use the table in VFP 9 with STRICTDATE SET TO 2, I get the error "Index does not match the table.  Delete the index file and re-create the index"

    If STRICTDATE SET TO 1 or 0, you don't get the error.

    Could your index problem be related?

    Wednesday, September 15, 2010 2:02 PM