Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Not a Table error
Message
De
17/05/2003 05:21:45
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
16/05/2003 15:25:22
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00789259
Message ID:
00789637
Vues:
26
>>>>>I'm getting a 'Not a Table' error when trying to open a table. What exactly is this error and can it be repaired?
>>>>>Thanks.
>>>>
>>>>Ernest,
>>>>Message #588605 might help.
>>>>Cetin
>>>
>>>Cetin,
>>>Thanks for responding. I tried your function, but the ReadBytes function generates the following error: 'Cannot access charaters beyond string'
>>
>>Ernest,
>>I didn't poke much error checking there.
>>-Does filename ('mytable.dbf') exist ?
>>-Accessible for read/write
>>-Size ?
>>Cetin
>
>Cetin the table is approx 89 meg. I can not open it - the 'Not a Table' error comes up. I should be able to read/write at low level.

Ernest,
Now you should have a backup (you do ,right?) let's try again.

First be sure file is closed and accesible for read/write and run the previous prg again.
If that fails try to do what it does manually :

do home()+'tools\hexedit\hexedit' with 'yourtablename.dbf'

You'd see a window with row and column headers and a data area full of 2 digits hex numbers like F3 03 ... You'd need fox main and command window too. Hexedit window is toplevel, arrange so that you can easily switch between and while in command window can see first row of numbers.

Column headers at top show offset position (0 to F).
When you need a value you'd read it from right to left. ie:

Suppose you're reading 4 bytes value from offset 4. To do that starting from offset 4 (column header) read 4 bytes (2-digits hex values).

If it were : 01 02 03 04

In command window execute (written in reverse order and prefixed with 0x) :

? 0x04030201

We only need values from first row. Check these and note down their values :

4 bytes from offset 4 - (Under col 4,5,6,7) This is recorded RECCOUNT
2 bytes from offset 8 - (Under col 8,9) This is HEADERSIZE
2 bytes from offset 10 - (Under col A,B) This is RECORDSIZE

In command window doing it like this would help :
lnReccount = 0x04030201
lnHeaderSize = 0x0201
lnRecordSize = 0x0201

At the top of window there is file size. A number ending with 'h' and a value in parentheses. Value in parentheses is decimal and other is hex ('h' stands for hex). Note the value there too.

lnFileSize = 0x1B91 && Drop h at end

Now calculate the reccount :

lnCalcRecco = floor((lnFileSize-(lnHeaderSize+1))/lnRecordSize)
? lnCalcRecco, lnReccount

These 2 should match. If matches already then your problem is different. If didn't match :

? transform(lnCalcRecco, '@0')

This would give you a hex number. ie : If lnCalcRecco was 1234567, it'd display 0x0012D687

Write this value into positions 4,5,6,7 starting from right :
Address   0  1  2  3  4  5  6  7  8
-------- -- -- -- -- -- -- -- -- --
00000000             87 D6 12 00
And close saving.

PS: This is for only fixing the most common header problem. A table might be corrupted by other means too. There are other things that might help you determine the validity of header but rather complex to cover here. But few basic helpers :
Value at position 0 is 30 for VFP tables
Value at positions 1,2,3 is last update date where 3 - day, 2 - Month and 1 - 2digits year
Table Columnnames line up starting on row 3 and left aligned. You should see a columnname every other row. After columnnames there is _NullFlags and when you see that on left area you should see dbc name if table is part of a dbc. After dbc name there are 00 values up to first record entry. First record entry starts with 20 (delete flag - not deleted).
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform