Hi lost, Does your table "SubRecords" have a primary key<http://en.wikipedia.org/wiki/Primary_key> ?
If so, you could use the SQL UPDATE statement<http://www.sql-tutorial.com/sql-update-sql-tutorial/>, rather than DELETE followed by INSERT. If the table does not have a primary key, there are compelling reasons to add one, so please post back either way. The following page from the CF Docs covers "Creating an update action page with cfquery" which will show you some of the basics: http://livedocs.macromedia.com/coldfusion/7/htmldocs/00001261.htm#wp1110980 With Flex, you will need to have logic to programmatically track which records have been modified (say be adding a flag variable to each record). If your system may ever have 2 or more users simultaneously, it will be very important to ensure that your application implements proper transaction management<http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10743/transact.htm>logic. This will include your having a mechanism for ensuring, before you execute the UPDATE statement, that the record in the table was not modified by another user between the time that the data was initially retrieved and sent over to Flex, up to the moment that the UPDATE is executed. Implementing transaction management logic is just as important with your DELETE followed by INSERT logic. Do you have a database administrator (DBA) on your team? If so, they will be an excellent person to walk you through this. Also, for most seasoned ColdFusion developers, implementing SQL UPDATEs is old hat :-) btw ... what database are you using (Oracle, MySQL, Microsoft, etc)? Please post back if you would like clarification on any of this. hth, g On 11/17/06, lostinrecursion <[EMAIL PROTECTED]> wrote:
Hi all, I have been programming for a while now and have always used a particular method to update sub-records in a data driven application. I know there is a better way and was hoping flexcoders could point me in a solid direction. Let's say I have a table called "MasterRecords" and one called "SubRecords" - Each record in the SubRecords table has a Foreign Key called MasterRecordsID which ties it to the MasterRecords table. When I do an update I typically go through and delete all instances of SubRecords from that table and then re-insert them. It is a working method, but tends to create load on the database that is not needed. Is there a better way to handle updates of SubRecords?

