Re: EDB error
- Posted by Rubens Monteiro Luciano <rml at rubis.trix.net> Oct 29, 2003
- 422 views
Robert, Matt and all; After using db_compress() I could access the wrong record which shows key: -9 record: -10 and then delete it using EDB Browser. Problem solved. The edb file is ok now. But what could have caused this? And why these values -9 and -10 ? Could it be a memory fault or HD error ? Or even a crash in the system ? Other possibillities? Thanks for the help !! Rubens At 13:45 28/10/2003, you wrote: > >Rubens Monteiro Luciano wrote: >>> > I'm getting this error in my EDB file when I try to delete a >>> > register. >>> > >>> > ( if db_record_key(i) = -9 then db_delete_record(i) end if ) >>> > >>> > I suspect that my edb file is corrupted. >>> > I can open it in the excellent Matt Lewis EDB Browser, and see that >>> > the last register entered is key: -9 and register: -10. >>> > This values are impossible to exist in my program, so I believe >>> > this could be a crash in the computer or media. >> >>... >>Fatal Database Error: bad record number > >I wonder if you have some code like: > > for i = 1 to db_table_size() do > if db_record_key(i) = -9 then > db_delete_record(i) > end if > end for > >When you delete one of the records, the size of the >table changes, and all the subsequent records are renumbered. >db_table_size() is only evaluated once, at the start of the loop. >By the time you get to the end, you are short one record >(i is too big), so EDS says "bad record number". >Maybe you should try a while loop: > > i = 1 > while i <= db_table_size() do > ... > i += 1 > end while > >I haven't had any reports of mysteriously >corrupted .edb files, but I once had my own .edb file >get corrupted when I built it on Windows and uploaded >it to FreeBSD using FTP. I accidentally uploaded it in "text" >or ASCII mode, rather than binary mode. This >changes the line terminator characters. i.e. \r\n is changed >to \n. (i.e. anywhere in the .edb file where you have the >two bytes: 13 10, they will be changed to one byte: 10). >When I uploaded it again in binary mode it was fine. > >Regards, > Rob Craig > Rapid Deployment Software > http://www.RapidEuphoria.com > > > >TOPICA - Start your own email discussion group. FREE! > >