4 Replies - 5356 Views - Last Post: 08 February 2012 - 10:41 AM Rate Topic: -----

#1 connorr  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 07-February 12

Deleting a record within a .dat file

Posted 07 February 2012 - 02:09 PM

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.

Is This A Good Question/Topic? 0
  • +

Replies To: Deleting a record within a .dat file

#2 Neku  Icon User is offline

  • D.I.C Regular

Reputation: 20
  • View blog
  • Posts: 268
  • Joined: 21-May 09

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 :)
Was This Post Helpful? 0
  • +
  • -

#3 connorr  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 07-February 12

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.
Was This Post Helpful? 0
  • +
  • -

#4 Neku  Icon User is offline

  • D.I.C Regular

Reputation: 20
  • View blog
  • Posts: 268
  • Joined: 21-May 09

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 :)
Was This Post Helpful? 1
  • +
  • -

#5 Toadill  Icon User is offline

  • D.I.C Regular

Reputation: 45
  • View blog
  • Posts: 392
  • Joined: 08-January 12

Re: Deleting a record within a .dat file

Posted 08 February 2012 - 10:41 AM

View PostNeku, on 08 February 2012 - 12:22 PM, said:

then it would be nice if you post your code so i can help :)


Great point! Lets see the code!
As a matter of fact it should be the first thing you do when you ask a question!

This post has been edited by Toadill: 08 February 2012 - 10:42 AM

Was This Post Helpful? 1
  • +
  • -

Page 1 of 1