Board index » delphi » File and Record
Mike Moore
![]() Delphi Developer |
File and Record2004-06-24 09:50:05 PM delphi102 Hello everyone, I'm trying to create small text database file for about 100 records only I want to be able to add, edit, delete and find from same file. I spent hours to find out from help file(which needs help) and websites, but I couldn't find any kind solution for what I am looking for. any help or guide will appreciated, thanks in advance I have this Type TCustomer = Record RecordID : string[7]; firstName : string[20]; lastName : string[20]; address1 : string[100]; address2 : string[100]; city : string[20]; postCode : string[8]; End; //Not working always overwrite my record procedure TForm1.AddNewClick(Sender: TObject); var F : file of TCustomer; MyCustomer : TCustomer; begin MyCustomer.RecordID :='0000123'; MyCustomer.firstName :='Mike'; MyCustomer.lastName :='Test'; MyCustomer.address1 :='123 Street'; MyCustomer.address2 :='No 121'; MyCustomer.city :='Anycity'; MyCustomer.postCode :='123456'; //add record AssignFile(F,'C:\MyCustomers.dat'); // Rewrite(F); // overwrite the file-not good Reset(F); try Write(F, MyCustomer ); finally CloseFile(F); end; end; |