Microsoft KB Archive/128078

= How to Trap for "Not a Database" Error in a Corrupt .DBC =

Article ID: 128078

Article Last Modified on 2/12/2000

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition

-



This article was previously published under Q128078



SUMMARY
If a Database Container (.DBC file) becomes corrupted or damaged, it may generate error number 1552: File " " is not a database. This article shows by example how to trap for this error by using an ON ERROR routine.



MORE INFORMATION
To demonstrate, perform the following steps:  Create a new database and call it DATA1.DBC  In the Database Designer, right-click and choose New Table. Create a new table with the following fields:      Field  Type       Width ---

Test1 character  10 Test2 character  10 When prompted to Input Data Records Now, choose Yes and add data to the table.   Issue the following commands in the Command Window: CLOSE ALL USE c:\vfp\data1.dbc &&actual path to your .DBC file may be different BROWSE 

CAUTION: If you are using an existing file instead of the example file created here, please back it up before proceeding to the next step.  Change the PARENTID in the first record to 0, then Save and Close the table.  Type the following into a program and run it: ON ERROR DO errhand        && To trap, and send to the error && handler procedure OPEN DATABASE SYS(2004)+'data1.dbc' && An existing corrupt DBC file ON ERROR                      && To reset ON ERROR to default

PROCEDURE errhand             && The error handler IF ERROR=1552                 && Check which error occurred WAIT WINDOW 'Error #: '+STR(ERROR)+' Message: '+MESSAGE ENDIF </li></ol>

The error message "Error #1552 Message:File C:\VFP\DATA1.DBC is not a database." should be displayed in a Wait window.

Additional query words: trap error VFoxWin

Keywords: kbcode KB128078

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.