How to edit dbf records in Delphi 1.02 with uniqueness demand?
Posted on 1997-07-03
How to edit dbf records? I try to work out a proper way of doing it. Let's say I have dbf file with an index and I want inserted records to be unique. On the other hand I do not want to use additional components (TEdit or TMaskEdit) to keep the data before inserting new record.
So, I have DBGrid on my form connected to Table1. It is used to browse the data. And I have a couple of DBEdits connected with current record in DBGrid. They are disabled. I push edit button on my form and I enable DBEdits and disable DBGrid. The user change data in DBEdits. They are accepted and then I have to check out if the key is unique. In dbf standard I have to seek for the new value, but moving the pointer in the table calls post method and the changes are written to the file. Somebody told me I can use two TTable components to connect to the same dbf file. Table1 is connected to DBGrid, Table2 to DBEdits. The user can edit data in DBEdits, and the program can check the data using Table1. It does not call the post for Table2. It works great, but after inserting record into Table2 I cannot get Table1 and Table2 synchronized. DBGrid does not show newly inserted records, although I make Table1.Refresh.
So my question is - how to edit dbf files which require uniqueness without additional components?