Components for Delphi and C++ Builder.

Go to Russian forum
Go to EhLib.com
It is currently 13 Feb 2025, 16:17

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: 04 Sep 2024, 18:25 
Offline

Joined: 16 Jul 2014, 17:35
Posts: 32
I have TFDQuery-->TDataSetDriverEh-->TMemTableEh-->TDBGridEh components in my form. In a MemTableEh connected to the DBGridEh, whenever the user adds a row (that is, a record) in MemTableEh, I want the program to automatically add a new record equal to it (except for the value of some of its fields) immediately, and so on. For example, if it has 3 fields: FirstName, LastName and Age fields, the new record generated by the program will have the record values ​​entered by the user, except for Age field, which I want to be empty, for example, the user should enter the following record with the following values:
First Name: Alan
Last Name: Cole
Age: 36
The generated record corresponding to it should be as follows:
First Name: Alan
Last Name: Cole
Age: null

I used the AfterInsert event, one problem is that it got stuck in an infinite cycle because of recursive calls and adds infinite new records. What is the appropriate and optimal approach?
Thanks


Last edited by rezap405 on 06 Sep 2024, 21:37, edited 3 times in total.

Top
 Profile  
 
PostPosted: 04 Sep 2024, 21:42 
Offline

Joined: 08 May 2014, 18:06
Posts: 695
Hello

Do you want two records to appear in the DataSet after the user adds one record?

_________________
Best regards
EhLib Support Team


Top
 Profile  
 
PostPosted: 05 Sep 2024, 02:51 
Offline

Joined: 16 Jul 2014, 17:35
Posts: 32
No, I want the program to add only one record for each record the user enters. But this new record will be added automatically by the program codes in the BeforeInsert or AfterInsert or OnNewRecord event, or any other event that is suitable. It has the ability to be edited by the user before the user clicks on the save button.
For example, in the above example, the end user edit the null age and input 24.
So, I have two records, (Alan, Cole, 36) and (Alan, Cole, 24).


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group