NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: olu on August 14, 2012, 04:27:07 AM

Title: On inserting a record add another record to another table
Post by: olu on August 14, 2012, 04:27:07 AM
Please can anyone help i am trying to insert a record but would like to insert another record in another table using values from the first record
Title: Re: On inserting a record add another record to another table
Post by: Bruce on August 14, 2012, 06:01:27 AM
You should probably use the PostInsert routine in the form, to add your own code to add the secondary records.

cheers
Bruce
Title: Re: On inserting a record add another record to another table
Post by: olu on August 14, 2012, 06:29:16 AM
Hi bruce thanks for the reply but then how do i handle auto increment id on the othe table and also because these files are going to be related how do i get the id number of the table that i am on at the moment which is also set to auto-increment?
Title: Re: On inserting a record add another record to another table
Post by: Bruce on August 14, 2012, 06:47:43 AM
basically, you do it the way you would do any clarion code. In the Post Insert the insert has been done, and _usually_ the parent field auto-increment has been set. (There's a file driver switch you should set if you're doing SQL). The child table auto increment is done for you when yo do a .Insert on the child table. But of course prime the child record linking fields to the parent table id.

cheers
Bruce