Hi, totally new to the forum so please correct me on any incorrect etiquette as I don't wish to offend anyone. I know this question has been asked in many forums across the internet but I really need a personal response from someone as I am really stuck on this one. Basically I have created a system that allows users to log in to a reward system, as there will be a system administrator, the need to delete a users record (this will include first and last name etc). I have stored the records in a .DAT file and really need to know how I can delete a record from the file should a user need to be removed from the system. Any methods with clear examples would be much appreciated. Thank You.
Deleting a record within a .dat file
Page 1 of 14 Replies - 2461 Views - Last Post: 08 February 2012 - 10:41 AM
Replies To: Deleting a record within a .dat file
#2
Re: Deleting a record within a .dat file
Posted 07 February 2012 - 04:35 PM
well it really depened on how you open the file.
in VB6 you have 3 way to open it.
you can open it as binary and then you can write and read from/to the file at the same time.
if the file as a known structure then you can open it as sequel, basically since you know its structure you can expect certian lines to be inside it but in this mode you cant write and read in the same time.
if its structure is unknown or is record based then you open it as rendom access.
if its a structure you defined yourself then why not opening the file and reading line by line until you get the part you want to delete and then just put empty string insted of it and save the file again?
if its unknown or record based then i think this link could help: Rendom access file
i hope this help you
in VB6 you have 3 way to open it.
you can open it as binary and then you can write and read from/to the file at the same time.
if the file as a known structure then you can open it as sequel, basically since you know its structure you can expect certian lines to be inside it but in this mode you cant write and read in the same time.
if its structure is unknown or is record based then you open it as rendom access.
if its a structure you defined yourself then why not opening the file and reading line by line until you get the part you want to delete and then just put empty string insted of it and save the file again?
if its unknown or record based then i think this link could help: Rendom access file
i hope this help you
#3
Re: Deleting a record within a .dat file
Posted 08 February 2012 - 09:51 AM
I appreciate the response, it is opened as a random access file, the link you gave I have already read but unfortunately it still does not help with my problem, I would appreciate a response personalized to my problem/code.
#4
Re: Deleting a record within a .dat file
Posted 08 February 2012 - 10:22 AM
then it would be nice if you post your code so i can help
#5
Re: Deleting a record within a .dat file
Posted 08 February 2012 - 10:41 AM
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote





|