How to remove a record from a random file 
Author Message
 How to remove a record from a random file

Does anybody here know how to remove a record from Random File in VB
physically! It seems no such command in VB to let user to remove a
record but Add a record!
Please reply me by E-mail! it's so urgent!
Thanks a lot!



Wed, 11 Mar 1998 03:00:00 GMT  
 How to remove a record from a random file


Quote:
>Does anybody here know how to remove a record from Random File in VB
>physically! It seems no such command in VB to let user to remove a
>record but Add a record!
>Please reply me by E-mail! it's so urgent!
>Thanks a lot!

It's been a while since I used VB, but I think it uses the standard Microsoft
Random file type, in which case you cannot delete records from it.

Standard Random File logic employs the use of pointers embedded either in the
records or in an external (second) random file, and you "delete" records
logically by removing the pointers from the "active" chain and attaching them
to the "delete" chain.

Any "add" operation would then check the "delete" chain first for an available
record slot before grabbing more disk space.

To physically remove records from such a file, you'd have to copy all the
"active" records to a new file, erase the old file, and rename the new file.

Note that this approach can be used more effectively with BINARY files than
with RANDOM files (but why I say that is too involved for me to go into at
this point).

Hope that proves to be of some help.

--
  ++   ++   "Well Samwise: What do you think of the elves now?"


  ++   ++------------------------------------------------------



Fri, 13 Mar 1998 03:00:00 GMT  
 How to remove a record from a random file

Quote:

> Does anybody here know how to remove a record from Random File in VB
> physically! It seems no such command in VB to let user to remove a
> record but Add a record!

VB is no different from any other language - It is very difficult to
remove a record However try the following :-

1)      Use ISAM instead - It does it for you.
2)      Copy the records (Less The blank) to another file. Then delete
        the original and rename the new file back to the old name.
3)      Move the blank record to the end of the file and then using
        a library routine written by QuickPac Pro (From
        Crescent Software) Clip the file by the length of the record.

OR -

4)      Move the blanks to the end of the file and then ignore them.
        when ever you say eof(1) say eof(1)- NoOfBlanks.
        Off course when you add another record make sure it goes into
        a blank record.

Hope this helps

Phil



Mon, 16 Mar 1998 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. How to remove a record from a random file

2. Does anyone know how to ...remove a record from a random file ?

3. Random access files - having and finding multiple types of record in one file

4. number of records in a random access file?

5. Locking records in a random file

6. # Records in a RANDOM ACCESS file?

7. Different size records in a random file?

8. Locking records in a random file

9. How to delete Random file record!

10. Adding a new record to a random file

11. Failure to Write a Random File record

12. deleting a record from random file

 

 
Powered by phpBB® Forum Software