[DUG] How to progress SQL - Devart for MySQL
Graham Marsden
grahamarsden at gmail.com
Mon Jun 29 18:47:58 NZST 2015
Hi Wallace
I have used Devart components to connect to a MySQLdatabase (local machine
and server based) for several projects.
They have been very robust, fast and well supported.
Having a look at the code fragments and your methodology I have a couple of
suggestions.
*If MessageDlg('Add member ?',mtConfirmation, [mbYes, mbNo], 0)= mrYes then
begin dm.tblMaster.Append; fMembers.ShowModal;*
* In the child form, which is called from a few other options, I have a
record refresh to ensure I have the latest data in a multiuser environment,
procedure TfMembers.FormShow(Sender: TObject); begin
dm.tblMaster.RefreshRecord; dm.tblClubMemMast.*
*RefreshRecord; dm.tblMaster.Edit; *
*However, my newly appended record is now gone and I'm positioned on
another valid record.*
In this scenario the .RefreshRecord statement occurs in the FormShow which
is after the .Append with the result that the current record has probably
changed. Your new record probably disappears as there has been no .Post
statement issued.
An .Edit statement is not required after an .Append as the .Append
statement leaves the new record in Edit mode.
So move your .Append to the location of the .Edit and delete the .Edit.
I have not used Master/Child relationships for data table editing - I keep
that for reports and data extraction queries.
For adding and editing data that approach seemed to add additional
processing overhead.
I prefer to have one query to get the master record then another to get the
child records based on their mater record / key.
Maybe that is not the pure approach but it has worked well for me.
Hope this helps.
Graham Marsden
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20150629/28adeee5/attachment.html
More information about the Delphi
mailing list