How you can see above, it's a kind of subclass a table in a RDBMS (in this case, my favorite: MySQL) so I handle it with Visual Subclassing a base form for tb_order_base with validating field data, etc.
This way, I'm free of repeating code and some other bothering problems, well, it seems a true OO aproach. But ...
Now I got a Big problem with subclassed form i.e. tb_order_service with a master/detail approach, when I post the tb_order_base dataset, instead of Delphi first post it and get the PK ID from RDBMS and then post the TB_ORDER_PRODUCT with id filled, it does the opposed, posting the detail tb_order_product dataset first then master tb_order_base, so I get a big foreing key constraint error.
Does anyone has any idea to how to by-pass this amazing problem?
I have asked it before, but with few details in The Master/Detail Behavior
What is the build number of Delphi2009 after the fourth service pack?
Delphi 6 - read console app's output while running
Constant breakpoints? How to remove them?
When the user presses the save button, I would validate my edits and return any errors.
Is “implicitly imported” always a bad thing in Delphi packages?
If no errors then I would begin a database transaction, commit the master record (and then read the master record key back if its an insert), then run thru each table commiting the child records, followed by a commit of the transaction (or rollback if there were any problems saving child data).
Wrapping TStringList in a Record
Open source editors using (Uni)SynEdit [except Dev-PHP/Dev-C++]
I also stay away from using data-aware components.
How to create an array of controls?
They work great for simple utility type programs, but when you start creating a complex system using them you will find little gotchas along the way that are easily solved by using a standard edit and a function to push/pull data to/from the database.
Are there any good free/cheap Delphi grid controls?
The only exception I generally make would be for grids, but I only use the grid for selection...the actual editing is done using non data-aware components..