I have a master / detail application written in Delphi 2010 / dbExpress using firebird 2.3 I have found a problem
If I have two or three or more identical lines of data in the detail, changing any data in one of them also changes the data on the other lines, I guess this is because the update uses only the invoice_id and serial as keys and the data is equal in both cases, the update is done in the two cases.
Master Data Invoice_id, serial, customer_id, date 1, A, 1.12 / 12 / 2010开发者_JAVA技巧
Detail Data Invoice_id, serial, qty, description, Price 1, A, 10, BOXES OF SOME STUFF, 52.52 1, A, 10, BOXES OF SOME STUFF, 52.52
I guess I can fix this by using a field ltes name ir line_no in which each line would have a different number and so the data could be distinguished to make the update as follows:
Line_no, Invoice_id, serial, qty, description, Price 1.1, A, 10, BOXES OF SOME STUFF, 52.52 2.1, A, 10, BOXES OF SOME STUFF, 52.52
So the information is the same but it has also the line_no to differentiate the information in the update
Anyone know any way to do this on the client side, in the clientdataset,
Thank you very much and greetings
It seems that there is no primary key in your detail table (assuming invoice_id is the foreign key to the master table. To make sure that FireBird (or any dbExpress connected database) updates the correct record you should add a primary key (autoinc field) to the detail table.
精彩评论