I could use some feedback on how you personally do things when developing data-aware applications...
Back when I was a beginner it was great to just insert/edit data right into a DBGrid and let the fields validate the data for you... but then I moved on to having a separate form for Adding/Editing records because of validation and a few other reasons...
In some applications it seems necessary to do all inserting/editing using SQL statements which ensures as little communication with the server as possible, but this really slows down development, so in normal applications I'd rather skip the SQL INSERTs and UPDATEs unless necessary, and instead use data-aware controls. If I come across a field where I need special formatting or validation, then I'll use a non-data-aware control, and then insert the validated data into the field usually before I call Post.
Does that make sense?
So let's say for example I'm inserting a new Staff record.
I call FrmStaffAddOrEdit.showmodal;
On this form are a bunch of DBEdits etc and buttons: btnOkay and a btnCancel.
All the DBEdits use DataSource1.
The Dataset for DataSource1 will change depending on 1) whether I am inserting or editing a record and 2) who the Sender form is (Sometimes two or more forms will need to edit a record, and you just set the Dataset accordingly).
If I am inserting a record, then I will just use a query with SQL SELECT TOP 1 * FROM TblStaff,
which fetches the data structure and just 1 record, and then I set my Dataset to my Query.
If I am editing a record, then I simply connect my Datasource to the Dataset of the record I am editing.
Is this a good way or not? and is there a way you can improve upon this for me?