Blackwolf
asked on
Membership program Data delete
HI;
I am currently doing a project on a membership data base, using pascal, as part of a higher education course.
Everything seems to work apart from the delete.
After entering members details I can delete them from the screen, but when
the program is switched off and turned back on again the deleted information is back in the lists. I suspect that when switching the program off the data is some how saved. I've noticed that when using delete the A:\ drive where the files stored, does not light up.
I'm using pointers, the delete is for membership and competition details ( two different files )
Have used the DISPOSE(.....) to delete, but I have not Assgined them to the 'A' DRIVE, DO I need to do this??
When using POINTERS, if so where ??
As I've said, the file gets removed from the screen while in use, but once the program is turned off it seems to read it back to the 'A' DRIVE. Therefore, when the program is restarted all the removed files are reinstated.
Therefore I would be grateful for some expert help, as I am complete beginner at programming.
Hope to hear from someone soon, best wishes,
BLACKWOLF.....:)
I am currently doing a project on a membership data base, using pascal, as part of a higher education course.
Everything seems to work apart from the delete.
After entering members details I can delete them from the screen, but when
the program is switched off and turned back on again the deleted information is back in the lists. I suspect that when switching the program off the data is some how saved. I've noticed that when using delete the A:\ drive where the files stored, does not light up.
I'm using pointers, the delete is for membership and competition details ( two different files )
Have used the DISPOSE(.....) to delete, but I have not Assgined them to the 'A' DRIVE, DO I need to do this??
When using POINTERS, if so where ??
As I've said, the file gets removed from the screen while in use, but once the program is turned off it seems to read it back to the 'A' DRIVE. Therefore, when the program is restarted all the removed files are reinstated.
Therefore I would be grateful for some expert help, as I am complete beginner at programming.
Hope to hear from someone soon, best wishes,
BLACKWOLF.....:)
be sure that you do Close() on your files before exit from program !
Hi
How did you delete members details ?
You meen you delete a file by using "Erase" mProcedure or what
please more information..
Bakry
How did you delete members details ?
You meen you delete a file by using "Erase" mProcedure or what
please more information..
Bakry
and more details or sources would help also ;-)
ASKER
Edited text of question.
hey man, you are really at the very beginning ;-)
file is a file, it is stored on disk and if you want to change or erase something from it you have to do it explicetly using procedures
open, read, write, blockread, blockwrite, close.... depending of your data and way you working with it
pointer is a variable in memory and not tied to file unless you store or retrive it's value to/from file...
listen, just give us your source and we will fix it, ok ? ;-))
full explanation will take few hours and it's better to get some good book and read.....
file is a file, it is stored on disk and if you want to change or erase something from it you have to do it explicetly using procedures
open, read, write, blockread, blockwrite, close.... depending of your data and way you working with it
pointer is a variable in memory and not tied to file unless you store or retrive it's value to/from file...
listen, just give us your source and we will fix it, ok ? ;-))
full explanation will take few hours and it's better to get some good book and read.....
dispose doesn't delete anything, and it has nothing to do with the disk
dispose makes the program "forget" something...e.g., if you have a pointer that points to something (in MEMORY, of course), and you dispose of it, the info it pointed to is no longer usable by the program
there is absolutely no relation between this (memory pointers) and files
if you are a complete beginner at programming, my suggestion is just to forget you ever heard the word "pointer" for now...pointers are a confusing thing to grasp when you are first learning, and they can be dangerous (e.g. cause your system to hang) if used incorrectly
dispose makes the program "forget" something...e.g., if you have a pointer that points to something (in MEMORY, of course), and you dispose of it, the info it pointed to is no longer usable by the program
there is absolutely no relation between this (memory pointers) and files
if you are a complete beginner at programming, my suggestion is just to forget you ever heard the word "pointer" for now...pointers are a confusing thing to grasp when you are first learning, and they can be dangerous (e.g. cause your system to hang) if used incorrectly
Generally when you delete a record from a file you do the following:
Find out how far into the original file the record is eg, the 7th record.
Create a new file.
Copy all prior records from original file to new file, in this case the first 6 records.
Increment the record counter in the original file, in this case 7th to 8th.
Copy the 8th record to end of file in the original file to the new file.
Close both files.
Delete original file.
Rename new file to original file name.
Reopen file.
Find out how far into the original file the record is eg, the 7th record.
Create a new file.
Copy all prior records from original file to new file, in this case the first 6 records.
Increment the record counter in the original file, in this case 7th to 8th.
Copy the 8th record to end of file in the original file to the new file.
Close both files.
Delete original file.
Rename new file to original file name.
Reopen file.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
bakry99
Buf file builds up in size and eventually you must do the procedure I have listed. Some database programs do do what you have stated but even they have to clean out the dead wood eventually.
Buf file builds up in size and eventually you must do the procedure I have listed. Some database programs do do what you have stated but even they have to clean out the dead wood eventually.
ASKER
Thank's
bakry99, I've got it all working fine now.
The whole program ( about 5000 lines of code ) is working, just about finished. Just a few refinements to do.
Thankyou for your help.
Blackwolf.....:)
bakry99, I've got it all working fine now.
The whole program ( about 5000 lines of code ) is working, just about finished. Just a few refinements to do.
Thankyou for your help.
Blackwolf.....:)