To add to this. What many people do is create a Data Object (CFC, for exampe) modeling whatever record you are using here, and then create setXXX and setYYY to assign all the new values.
When writing setXXX functions in your CFC, lets say, you simply compare the data, and if it differs, you set a boolean flag called "isDirty" Then you loop through your data objects, saving anything which has isDirty=true.... make sense? dbk > Yes, I was thinking about using a structure but I am unsure of the > best way to do a comparison. Wouldn't this mean having to a field by > field comarison or is there a better way? I was wondering if anybody > had created a custom tag to do just this sort of thing. > > >Should be easy enough and no doubt several way s to achieve this.... > both in > >CF Code and in SQL. One way would be to load the records at page > load into > >a structure and then on submit comparing both the pre-edited and post > edited > >form struct to see what has changed etc... > > > > > > > >-----Original Message----- > >From: Andy Mcshane [mailto:[EMAIL PROTECTED] > >Sent: 26 May 2006 10:25 > >To: CF-Talk > >Subject: Only update DB if data has changed? > > > >Hi all, does anybody have any ideas how I could best implement the > >following; > > > >I have a page that loads anything up to about 30 individual records > at a > >time. Each record consists of 17 fields of data. All the records are > >displayed on the page to give the user the option of editing any > individual > >field. When the user then submits the page I need to be able to work > out > >which records have had data changed and only do database updates for > those > >specific records. Having an individual submit for each record is not > an > >option, the whole page must be submitted as one but only records that > have > >changed should be updated. Can anybody suggest a method for doing this? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:241545 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54