BUG: COPY TO WITH CDX Causes to .CDX to Become Corrupt

Last reviewed: June 27, 1995
Article ID: Q111756
The information in this article applies to:
  • Microsoft FoxPro for Windows, versions 2.5, 2.5a, 2.5b, 2.6
  • Microsoft FoxPro for MS-DOS, versions 2.0, 2.5, 2.5a, 2.5b, 2.6
  • Microsoft FoxPro for Macintosh, versions 2.5b

SYMPTOMS

When the COPY TO command is used with the WITH CDX clause, the .CDX file will become corrupt when following conditions are present:

  • There are deleted records in the table.
  • SET DELETED ON is set.
  • The COPY TO ... WITH CDX command doesn't have a FOR or WHILE clause.

Other symptoms of this problem are the error messages "Index does not match table. Recreate index." and "Table is not ordered."

RESOLUTION

To work around this problem, use a FOR or WHILE clause with the COPY TO command. For example:

   COPY TO <filename> WITH CDX FOR .T.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Steps to Reproduce Problem

Run the following program:

   CLEAR ALL
   CLOSE ALL
   SET DELETED OFF
   CREATE TABLE original (idnum C(3))
   FOR i = 1 TO 100
        INSERT INTO original (idnum) VALUES ( STR( m.i, 3, 0 ) )
   ENDFOR
   INDEX ON idnum TAG idnum
   DELETE FOR RECNO() % 10 = 0
   USE
   USE original
   SET DELETED ON
   COPY TO t_copy WITH CDX

   USE t_copy ORDER idnum
   IF SEEK( " 10" )
        WAIT WINDOW "Seeking 'idnum 10',  we found " + idnum + ;
        ". But we shouldn't have found anything."
   ENDIF

The SEEK(" 10") function call should return .F.; therefore, the WAIT WINDOW should never appear.


Additional reference words: FoxMac FoxDos FoxWin 2.00 2.50 2.50a 2.50b 2.60
buglist2.00
buglist2.50 buglist2.50a buglist2.50b buglist2.60 errmsg err msg
KBCategory: kbprg kberrmsg kbbuglist
KBSubcategory: FxprgGeneral


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 27, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.